Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 2.7 Cx_Freeze: ImportError: No module named __startup__

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.

like image 614
Tomas Regnier Avatar asked Dec 01 '16 06:12

Tomas Regnier


1 Answers

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.

like image 127
Jlondono Avatar answered Oct 26 '22 15:10

Jlondono