操作系统错误:找不到[WinError 126]模块
问题描述
我正尝试在python中运行MXNet port of SSD,但当我运行demo时遇到一个奇怪的错误:
OSError: [WinError 126] The specified module could not be found
特别是在尝试打开libmxnet.dll
时,因此我在尝试调试它时发现。
整个错误消息如下:
>>>> kernel32
>>>> C:UserswisdomAnaconda3envsgpu-testlibsite-packagesmxnetlibmxnet.dll
Traceback (most recent call last):
File "demo.py", line 2, in <module>
import tools.find_mxnet
File "C:UserswisdomDesktopmxnet-ssd-master oolsfind_mxnet.py", line 6, in <module>
import mxnet as mx
File "C:UserswisdomAnaconda3envsgpu-testlibsite-packagesmxnet\__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "C:UserswisdomAnaconda3envsgpu-testlibsite-packagesmxnetcontext.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "C:UserswisdomAnaconda3envsgpu-testlibsite-packagesmxnetase.py", line 213, in <module>
_LIB = _load_lib()
File "C:UserswisdomAnaconda3envsgpu-testlibsite-packagesmxnetase.py", line 204, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "C:UserswisdomAnaconda3envsgpu-testlibctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
其中带>符号的前两行向我试图调试的行指示,并检查在...ctypes\__init__.py
文件中触发错误的位置/时间,如下所示
if handle is None:
x = (self._name)
print('>>>>',x)
self._handle = _dlopen(self._name, mode)
我当然检查了请求的文件是否存在libmxnet.dll
,它就在那里,但每当调用它时,它都会抛出这个错误!
解决方案
确定最终解决!
我了解到,当未满足或未找到文件依赖项时,可能会引发此类错误。因此,要检查依赖项,请首先转到Visual Studio提示符,然后导航到libmxnet.dll
所在的文件夹并运行以下命令
dumpbin /dependents libmxnet.dll
它将向您显示所需文件的列表。
我的案例中缺少的是一些nVidia GPU Computing Toolkit
文件Cuda 9.0
,因为libmxnet.dll
需要它们,而我使用的是工具包版本10.0!
相关文章