当前位置: 代码迷 >> 综合 >> ctypes 载入 dll 产生[WinError 126] 错误原因及解决
  详细解决方案

ctypes 载入 dll 产生[WinError 126] 错误原因及解决

热度:35   发布时间:2024-01-04 10:07:26.0

本文参考自ctypes 载入 dll 产生[WinError 126] 错误原因及解决

查看原文: 原文地址

背景:c++自定义创建dll,依赖于gda201.dll(如何创建dll的部分略),并提供给python调用

Objdll = ctypes.cdll.LoadLibrary('D:\\ge\\testDLL\\x64\\Debug\\testDLL.dll')    # 此处建议绝对路径

报错信息:

Traceback (most recent call last):
  File "E:\PyCharm 2017.3.4\helpers\pydev\pydev_run_in_console.py", line 53, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "E:\PyCharm 2017.3.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/ProJect/PyCharm/DataPrepare/testDLL.py", line 7, in <module>
    Objdll = ctypes.cdll.LoadLibrary('D:\\ge\\testDLL\\x64\\Debug\\testDLL.dll')
  File "C:\Python36\lib\ctypes\__init__.py", line 426, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)

OSError: [WinError 126] 找不到指定的模块。


  相关解决方案