1

我一直在尝试让 cx_freeze 在 ubuntu 上运行,但是当我尝试运行“python setup.py build”时出现以下错误:cx_Freeze.freezer.ConfigError: no initscript named Console

我搜索了谷歌,我看到很多人都有这个问题,但我似乎无法找到解决方案。

我的 setup.py 代码如下:

from cx_Freeze import setup, Executable


setup( name = "hello world" ,
   version = "0.1" ,
   description = "Hello" ,
   executables = [Executable("hello.py")] ,
   )    

我已将 setup.py 文件和 hello.py 放在同一个文件夹中。关于什么可以解决这个问题的任何想法?

running build
running build_exe
Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    executables = [Executable("hello.py")] ,
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-i686.egg    
  cx_Freeze/dist.py", line 365, in setup
    distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-i686.egg
  /cx_Freeze/dist.py", line 234, in run
    metadata = metadata)
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-i686.egg
  /cx_Freeze/freezer.py", line 104, in __init__
    self._VerifyConfiguration()
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-i686.egg
/cx_Freeze/freezer.py", line 466, in _VerifyConfiguration
    self._GetInitScriptFileName()
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-i686.egg
/cx_Freeze/freezer.py", line 311, in _GetInitScriptFileName
    raise ConfigError("no initscript named %s", name)
cx_Freeze.freezer.ConfigError: no initscript named Console
4

1 回答 1

2

对于我的安装,我遇到了同样的问题。看起来像未创建 initscripts 的符号链接,所以我手动创建它并且一切正常(将 cx_Freeze 版本更改为您自己的):

cd /usr/local/lib/python2.7/dist-packages/
cd cx_Freeze-4.3.1-py2.7-linux-i686.egg
sudo ln -s -t cx_Freeze/ ../../cx_Freeze/initscripts/

PS:Ubuntu 12.10/量子,Python 2.7.3

于 2013-04-19T02:55:33.200 回答