我正在尝试使用 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 *。