全世界的人们,大家好,
我刚刚完成了一个项目,并且希望能够将其转换为 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 = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="452920322c3605372423312330372b2c313037206b262a6b302e" rel="noreferrer noopener nofollow">[email protected]</a>",
options = {"build_exe": {"excludes":excludes,"packages":packages,
"include_files":includefiles}},
executables = [exe]
)
这非常简单。
这很令人愤怒,因为我对此无能为力,必须有人找到答案!
非常感谢!
最佳答案
重新发布作为答案:这是 known bug这是因为 cx_Freeze 是使用与您所使用的不同的 Python 3.4 错误修复版本构建的。
从 this site 重新安装 cx_Freeze 。使用新版本的 Python 重新编译,修复了错误。
关于使用 Cx_freeze Python 进入 MSI Exe,错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25367441/