小编Saa*_*bel的帖子

无法使用 ctypes 在 python 中加载 dll

我正在尝试使用 ctypes 加载 dll 形式的 python 代码,但它引发了错误。

我的Python代码:

import ctypes
from ctypes import *
hllDll = ctypes.WinDLL ("c:\\Users\\saar\\Desktop\\pythonTest\\check.dll")
Run Code Online (Sandbox Code Playgroud)

这引发了错误:

Traceback (most recent call last): 
  File "C:\AI\PythonProject\check.py", line 5, in <module> 
    hllDll = ctypes.WinDLL("c:\\Users\\saar\\Desktop\\pythonTest\\check.dll") 
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__ 
    self._handle = _dlopen(self._name, mode) 
WindowsError: [Error 126] The specified module could not be found 
Run Code Online (Sandbox Code Playgroud)

我用谷歌搜索它,我看到的每一篇文章都指南如何用两个反斜杠编写dll路径,或者导入ctypes,然后编写:from ctypes import *。

python dll ctypes python-2.7

6
推荐指数
1
解决办法
7429
查看次数

标签 统计

ctypes ×1

dll ×1

python ×1

python-2.7 ×1