【发布时间】:2019-05-15 12:41:44
【问题描述】:
我知道有很多关于 WinError 126 等的帖子。但我真的需要帮助...
我有一个这样的目录:
- mytestscript.py
- my32bit.dll
- my64bit.dll
我安装了 32 位和 64 位 Python 解释器。 现在,如果我使用 32 位解释器运行 mytestscript.py,一切正常。
import ctypes
dll = ctypes.windll.LoadLibrary("my32bit.dll")
print(dll)
但如果我使用 64 位解释器运行它
import ctypes
dll = ctypes.windll.LoadLibrary("my64bit.dll")
print(dll)
我得到以下错误:
Traceback (most recent call last):
File "C:/Users/Heinzeri/Desktop/TEMPY/mytestscript.py", line 4, in <module>
dll = ctypes.windll.LoadLibrary("my64bit.dll")
File "C:\Program Files\Python37-64\Lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Program Files\Python37-64\Lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [Error 126] The specified module could not be found
64 位 Python 找不到 DLL 的原因可能是什么? 我必须将它添加到 PATH / PYTHONPATH 吗? 我需要一些 Microsoft Redistributable 吗?
DLL 经过 64 位和 32 位检查,并且来自供应商。
【问题讨论】:
标签: python ctypes 32bit-64bit