2

I am very new to cx_Freeze, but when I tried to use pyHooks, it didn't work. here's my setup.py code:

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]
)

and when I run the exe file, the error says:

ImportError: cannot import name cpyHook

4

1 回答 1

2

好的,一种解决方法是手动包含cpyHook.py.

options = {"build_exe": {"includes":includes, 'include_files': ['cpyHook.py']}},

你可以cpyHook.py进去<python install dir>\Lib\site-packages\pyHook\

于 2017-03-20T21:37:14.710 回答