我试图将我的python 3.4程序转换为exe用于分发。我尝试使用cx_Freeze来做到这一点。但是,当我使用此setup.py:
运行python setup.py构建时from cx_Freeze import setup, Executable
setup( name = "Converter" ,
version = "0.1" ,
description = "" ,
executables = [Executable("filename.py")] , )
我收到此错误代码:
C:\Python34>python setup.py build
running build
running build_exe
Traceback (most recent call last):
File "setup.py", line 6, in <module>
executables = [Executable("helloworld.py")] , )
File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\distutils\command\build.py", line 126, in run
self.run_command(cmd_name)
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 231, in run
metadata = metadata)
File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 136, in __init__
self._VerifyConfiguration()
File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 504, in _VerifyConfiguration
self._GetBaseFileName()
File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 239, in _GetBaseFileName
raise ConfigError("no base named %s", name)
cx_Freeze.freezer.ConfigError: no base named Console
当我尝试设置hello world文件时,会出现相同的错误代码。所以它与我的剧本无关。
有任何帮助吗?这是我第一次使用cx_Freeze。
答案 0 :(得分:2)
看来此行失败argsSource.base = self._GetFileName("bases", name, ext)
,这意味着它无法找到该文件,这是有道理的。检查此文件夹C:\Python27\Lib\site-packages\cx_Freeze\bases
是否为Console.exe
。如果您没有,请尝试重新安装cx_freeze。这是我的python目录。我会假设你的在同一个地方,但如果不是只是搜索它
答案 1 :(得分:0)
只需键入cmd“ pip install cx_Freeze”即可卸载cx_Freeze,然后再次通过键入“ pip install cx_Freeze”重新安装它。