大家好,
我刚刚完成了一个项目,很想把它变成一个 exe 文件来分发。
问题是每次我尝试使用 cx_freeze 来构建它时,在启动 EXE 时我都会收到此错误消息:-
Traceback(most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py",line 27, in <module>
exec(code,m.__dict__)
File"calculator.py",line 1, in <module>
file"c:\Python\64bit\3.4\lib\importlib\_bootsrap.py",line2214,in_fine_and_load
可能是错误消息中最相关的部分:- `AttributeError:'module'对象没有属性'fix_up_module'
我的设置脚本是这样的。
from cx_Freeze import setup, Executable
includefiles = ['prices.dat','raftlogomain.gif'] # include any files here that you wish
includes = []
excludes = []
packages = []
exe = Executable(
script = "calculator.py",
initScript = None,
base = 'Win32GUI',
targetName = "Glass Calculator.exe",
copyDependentFiles = True,
compress = True,
appendScriptToExe = True,
appendScriptToLibrary = True,
icon = None
)
setup(
name = "Glass Calculator",
version = "0.1",
description = 'Bespoke Calculations',
author = "Lewis Tabone",
author_email = "lewis@raftfurniture.co.uk",
options = {"build_exe": {"excludes":excludes,"packages":packages,
"include_files":includefiles}},
executables = [exe]
)
这很简单。
这真让人生气,因为我对此无能为力,必须有人知道答案!
非常感谢!
请您参考如下方法:
作为答案重新发布:这是一个 known bug由于 cx_Freeze 是使用与您使用的不同的 Python 3.4 错误修复版本构建的。
从 this site 重新安装 cx_Freeze .这是用新版本的 Python 重新编译的,修复了错误。
