When doing the project, due to the need to do DLL to speed up, but often burst out error
File "C:\Users\32373\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\32373\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The example code is as follows
from ctypes import cdll
class Demo():
def __init__(self):
self.__path = "ZeissControl2.dll"
self.__Library = cdll.LoadLibrary(self.__path)
It’s also a bug that has been bothering me for a long time.
for this problem, I summarize two reasons:
- the first thing is to check whether the path of the DLL file is correct. If it is correct, that is the second reason. When we generate a custom DLL, we usually rely on a variety of other DLL files, so we need to add other DLL files that the DLL calls depends on to the program running directory. In this case, the program can run perfectly OL> in general
However, in general, in addition to the specified DLL files, user-defined DLL files may also rely on the DLL files of the system environment
in the latter case, we generally do not know which DLL files we rely on
Fortunately, Visual Studio provides dumpbin/dependencies tool to get the list of DLL files that the specified DLL depends on
specific operation
Start Menu = & gt& gt; visual studio 2017 or 2019 ===>& gt; Developer Command Prompt for VS 2017 or 2019
After opening the terminal and entering the dumpbin command, you can see that
we want to view the list of other DLL files that the specified DLL file depends on. The command is as follows
dumpbin /dependents your_ dll_ path
For example,
Read More:
- Oserror: [winerror 126] cannot find the specified module self_ handle = _ dlopen(self._ name, mode)
- Ctypes loading DLL error oserror: [winerror 126] the specified module could not be found
- Oserror: [winerror 126] the specified module was not found. Pytoch couldn’t find caffe2_ detectron_ ops.dll
- Oserror: dlopen() failed to load a library: Cairo / cairo-2 / cairo-gobject-2/ cairo.so .2
- tensorflow import error: DLL load failed: The specified module could not be found (DLL load failed: The specified module could not be found)
- Module not found error: the solution to the problem of no module named ‘MySQL’
- Tensorflow import error: DLL load failed: the specified module could not be found
- Module not found: Error: Can’t resolve ‘./$$_gendir/app/app.module.ngfactory’
- Module parse failed:Unexpectedtoken (1:0)You may need an appropriate loader to handle this file type
- OpenCV3.1 + Python2.7 error “DLL load failed: The specified module could not be found”
- [Solved] Vue Project Error: This relative module was not found
- This relative module was not found
- Webpack 4 : ERROR in Entry module not found: Error: Can’t resolve ‘./src’
- error: <class ‘OSError‘>, [Errno 97] Address family not supported by protocol
- Error loading Python DLL ‘python36.dll’. LoadLibrary: The specified module could not be found.
- vscode import numpy error:DLL load failed: The specific module could not be found
- Python’s importerror: DLL load failed: the specified module was not found and the problem was solved
- npm start:Module not found: Error: Can’t resolve ‘xlsx’ in ‘/Users/huzhiqi/Downloads/web/…
- ImportError: DLL load failed: The specified module could not be found
- Module not found:Error:Can’t resolve ‘rc-animate/lib/CSSMotionList’ in ‘……’