【问题标题】:'System.IO.FileNotFoundException: Unable to find assembly' in clr library on Python“System.IO.FileNotFoundException:无法在 Python 的 clr 库中找到程序集”
【发布时间】:2020-06-28 01:25:57
【问题描述】:

我在使用 .dll 文件的代码中遇到了汇编错误。这是template code from another thread,很多人声称它有效。

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)

我检查了多个线程,但没有一个给出解决方案。我使用的是 Windows 10,此外,我的 .NET 框架版本是“4.0.30319.42000”。我的笔记本电脑处理器是 Atom Z3537F。

【问题讨论】:

    标签: python c windows cpu .net-assembly


    【解决方案1】:

    在 Windows python 安装中默认不安装 clr 模块。您需要在提示符下运行 pip install clr 以添加它,然后您的代码才能正确导入它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-04
      • 2011-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-28
      • 1970-01-01
      • 2023-02-07
      相关资源
      最近更新 更多