我正在使用 pyhook 和 pythoncom 编译一些 python 脚本。在从 pyHook.cpyHook 通知缺少名为 _cpyHook 的模块后,构建成功。当我启动 .exe 文件时,它会返回此导入错误。
Traceback (most recent call last):
File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_cpyHook', [dirname(__file__)])
File "C:\Python34\Lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_cpyHook'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 17, in <module>
File "E:\projects\pykalappai\EkEngine\Engine.py", line 3, in <module>
import pyHook
File "C:\Python34\Lib\site-packages\pyHook\__init__.py", line 1, in <module>
from .HookManager import *
File "C:\Python34\Lib\site-packages\pyHook\HookManager.py", line 1, in <module>
from . import cpyHook
File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 28, in <module>
_cpyHook = swig_import_helper()
File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 20, in swig_import_helper
import _cpyHook
ImportError: No module named '_cpyHook'
我已经用谷歌搜索并尝试了这些解决方案,例如
- 将 pyHook._cpyHook.pyd 重命名为 _cpyHook.pyd
- 将 _cpyHook.pyd 和 cpyHook.py 从 site-packages\pyHook 复制粘贴到 site-packages。
这些都不适合我。