Python 2.7 Cx_Freeze: ImportError: No module named __startup__

混江龙づ霸主 提交于 2019-12-01 01:15:07

问题


I am trying to compile a hello world program in Python into a stand-alone binary/package on Linux using cx_Freeze. When cx_Freeze is run, it completes without an error but when I attempt to run the generated executable, I am given the error:

ImportError: No module named __startup__

My setup.py file is:

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)

And it is run as such:

python setup.py build

I am confused as to why this is happening. If the ImportError was for a library, I would understand - but __startup__ is unfamiliar to me.

Thanks.


回答1:


I had the same problem with cx_Freeze 5.0.0. I was able to fix this after downgrading cx_freeze to 4.3.4. Other versions may also work.




回答2:


I encountered the same problem.For your goals, you can try pinstaller.'hello world' accurately compile. But the question remains open, how to conquer this bug



来源:https://stackoverflow.com/questions/40903605/python-2-7-cx-freeze-importerror-no-module-named-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!