Python 2.7 Cx_Freeze:ImportError:没有名为__startup__的模块

Tom*_*ier 7 python linux cx-freeze python-2.7

我正在尝试使用cx_Freeze将Python中的hello world程序编译成Linux上的独立二进制/包.当cx_Freeze运行时,它完成没有错误但是当我尝试运行生成的可执行文件时,我收到错误:

ImportError: No module named __startup__
Run Code Online (Sandbox Code Playgroud)

我的setup.py文件是:

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = [], excludes = [])

base = 'Console'

executables = [
    Executable('test.py', base=base)
]

setup(name='test',
      version = '1.0',
      description = '',
      options = dict(build_exe = buildOptions),
      executables = executables)
Run Code Online (Sandbox Code Playgroud)

它运行如下:

python setup.py build
Run Code Online (Sandbox Code Playgroud)

我很困惑为什么会这样.如果ImportError是一个库,我会理解 - 但__startup__我不熟悉.

谢谢.

小智 -3

我遇到了同样的问题。为了您的目标,您可以尝试 pinstaller.'hello world' 准确编译。但问题仍然存在,如何克服这个错误