【发布时间】:2015-08-13 09:31:30
【问题描述】:
我正在使用 python 2.7 使用 Python for .Net,我将所有需要的目录从 Python2.7 复制到我的应用程序目录中 当我尝试在交互式 shell 中导入 ctypes 时
import ctypes
错误是
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\TesetPyNet\bin\Debug\lib\ctypes\__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: DLL load failed: The specified module could not be found.
我要问的是有没有办法设置 Dll 文件夹的路径。
注意:当我将 python 3.4.3 嵌入到我的 c# 应用程序中并将 python 运行时目录复制到我的应用程序目录中时,它可以很好地导入 ctypes,即使在尚未安装 python 版本的操作系统上也是如此
【问题讨论】:
-
失败不仅是在导入 ctypes 时,而且在我导入任何模块时都需要 Dll 文件夹中的内置模块
-
正在寻找扩展模块
_ctypes.pyd,一般在Python27\DLLs。 -
它在 Python\DLLs 中的奇怪之处