Ctypes: [WinError 126] 找不到 DLL
Ctypes: [WinError 126] Cant find DLL
我知道有很多关于 WinError 126 等的话题。但我真的需要帮助...
我有这样一个目录:
- mytestscript.py
- my32bit.dll
- my64bit.dll
我安装了 32 位和 64 位 Python 解释器。
现在,如果我 运行 mytestscript.py 使用 32 位解释器,一切正常。
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 位检查,来自供应商。
这也可能意味着缺少另一个依赖项。请使用 Dependencies(Dependency Walker 的后继者)检查幕后发生的事情。
可能缺少某些 64 位运行时。
我知道有很多关于 WinError 126 等的话题。但我真的需要帮助...
我有这样一个目录:
- mytestscript.py
- my32bit.dll
- my64bit.dll
我安装了 32 位和 64 位 Python 解释器。 现在,如果我 运行 mytestscript.py 使用 32 位解释器,一切正常。
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 位检查,来自供应商。
这也可能意味着缺少另一个依赖项。请使用 Dependencies(Dependency Walker 的后继者)检查幕后发生的事情。
可能缺少某些 64 位运行时。