我对 cx_Freeze 很陌生,但是当我尝试使用 pyHooks 时,它不起作用。 这是我的 setup.py 代码:
from cx_Freeze import setup, Executable
includes=["re", "pyHook"]
exe = Executable(
script="hello.py",
base="Win32Gui",
targetName = "hello.exe"
)
setup(
name = "hello",
version = "1",
description = "description",
options = {"build_exe": {"includes":includes}},
executables = [exe]
)
当我运行 exe 文件时,错误提示:
导入错误:无法导入名称 cpyHook
最佳答案
好的,一种解决方法是手动包含 cpyHook.py
.
options = {"build_exe": {"includes":includes, 'include_files': ['cpyHook.py']}},
您可以获得cpyHook.py
在<python install dir>\Lib\site-packages\pyHook\
关于python - cx_freeze 不适用于 pyHooks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19330525/