'System.IO.FileNotFoundException:在Python上的clr库中无法找到程序集'。

2 人关注

我在使用.dll文件的代码中得到一个汇编错误。这是一个 来自另一个主题的模板代码 ,而且很多人声称它很有效。

import clr
import os
file = 'CPUThermometerLib.dll'
print('Does this filepath exist?',os.path.isfile(file)) 
clr.AddReference(file)

我想文件路径没有问题,因为它在.isfile函数中返回true。下面是我得到的输出。

Does this filepath exist? True
  File "<stdin>", line 1, in <module>
System.IO.FileNotFoundException: Unable to find assembly 'CPUThermometerLib.dll'.
   at Python.Runtime.CLRModule.AddReference(String name)