我正在尝试使用 cx_freeze 4.2.3 冻结 python 3.2.2 脚本。源脚本使用 PyQt4,我不确定这是否是问题的潜在根源。Python 在构建过程中崩溃。这是命令行输出:
C:\Python32\新建文件夹>python setup.py build
运行构建
运行 build_exe
复制 C:\Python32\Lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> build\exe.win32-3.2\app.exe
复制 C:\WINDOWS\system32\python32.dll -> build\exe.win32-3.2\python32.dll
Python 本身此时在 Windows 中崩溃并给出“发送错误报告”MS 对话框:
python.exe 遇到问题需要关闭。对此造成的不便,我们表示歉意。
这是我的 setup.py 文件:
from cx_Freeze import setup, Executable
GUI2Exe_Target_1 = Executable(
script = "script.pyw",
initScript = None,
base = 'Win32GUI',
targetName = "app.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False,
icon = "icon.png"
)
excludes = ["pywin", "tcl", "pywin.debugger", "pywin.debugger.dbgcon",
"pywin.dialogs", "pywin.dialogs.list", "win32com.server",
"email"]
includes = ["PyQt4.QtCore","PyQt4.QtGui","win32gui","win32com","win32api","html.parser","sys","threading","datetime","time","urllib.request","re","queue","os"]
packages = []
path = []
setup(
version = "1.0",
description = "myapp",
author = "me",
author_email = "email@email.com",
name = "app",
options = {"build_exe": {"includes": includes,
"excludes": excludes,
"packages": packages,
"path": path
}
},
executables = [GUI2Exe_Target_1]
)
关于我哪里出错的任何想法?
编辑:经过一些实验,我尝试使用的图标出现问题。如果我省略图标设置,它将建立。