我一直试图将我的python脚本分发给其他人一段时间,尝试了py2app等。最后似乎已经取得了CX_Freeze的最大进步。它使用来自cx_freeze的简单helloworld wxpython脚本完成应用程序的构建,但是我的脚本失败了。它失败了这个追溯:
running bdist_dmg
running bdist_mac
running build
running build_exe
creating directory build/exe.macosx-10.5-x86_64-2.7
copying //anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/bases/Console -> build/exe.macosx-10.5-x86_64-2.7/FirstProduction
Traceback (most recent call last):
File "setup.py", line 15, in <module>
executables=executables
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "//anaconda/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "//anaconda/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "//anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/macdist.py", line 58, in run
self.run_command('bdist_mac')
File "//anaconda/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "//anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/macdist.py", line 226, in run
self.run_command('build')
File "//anaconda/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "//anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "//anaconda/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "//anaconda/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "//anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/dist.py", line 232, in run
freezer.Freeze()
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/freezer.py", line 610, in Freeze
self.compress, self.copyDependentFiles)
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/freezer.py", line 510, in _WriteModules
module.Create(finder)
File "//anaconda/lib/python2.7/site-packages/cx_Freeze-4.3.3-py2.7-macosx-10.5-x86_64.egg/cx_Freeze/freezer.py", line 746, in Create
module.file, module.name)
cx_Freeze.freezer.ConfigError: no file named sys (for module boto.compat.sys)
当我在cx_freeze团队提供的另一个脚本上运行setup.py时,它构建正常,这里是回溯的一部分:
/MacOS
create_plist()
setRelativeReferencePaths()
prepare_qt_app()
buildDMG()
................................................................
created: /Users/Bailejor/Desktop/build/hello-0.1.dmg
任何见解都会很棒!