Reputation: 77
I know there are a lot of threads about the WinError 126 and so on. But I really need help...
I have a directory like this:
I have a 32 Bit and a 64 Bit Python Interpreter installed. Now if I run mytestscript.py with a 32 Bit Interpreter, everything works fine.
import ctypes
dll = ctypes.windll.LoadLibrary("my32bit.dll")
print(dll)
But if i run it with a 64 Bit Interpreter
import ctypes
dll = ctypes.windll.LoadLibrary("my64bit.dll")
print(dll)
I get the follwoing error:
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
What could be the cause that the 64-Bit Python doesn't find the DLL? Do I have to add it to PATH / PYTHONPATH? Do I need some Microsoft Redistributable?
The DLL's are checked 64bit and 32bit and come from a vendor.
Upvotes: 1
Views: 2899
Reputation: 7121
This could also mean that another dependency is missing. Please use Dependencies (successor of Dependency Walker) to check what is happening behind the scenes.
Maybe some runtime for 64-bit is missing.
Upvotes: 2