I'm trying to convert my Python project to a standalone executable, in order to run it on other servers that don't have Python installed.
Command used:
python setup.py build > build.log
When I try to run the resulting exe, it always spits out the following error message:
zipimport.ZipImportError: can't find module 'cx_Freeze__init__'
Fatal Python error: unable to locate initialization module
Current thread 0x00000b8c (most recent call first):
I've tried to define all the libraries I'm using throughout my project in the setup.py
module, though this has made no difference.
I have also added the DLL files to include (described in the post cx-freeze doesn't find all dependencies).
The project consists of the following libraries (output of pip list
):
cx-Freeze (4.3.2)
docopt (0.6.1)
pip (1.5.4)
psutil (2.0.0)
pywin32 (218)
requests (2.2.1)
setuptools (2.2)
virtualenv (1.11.4)
WMI (1.4.9)
Contents of setup.py
:
include_files=[
(r'C:\Python34\Lib\site-packages\pywin32_system32\pywintypes34.dll', 'pywintypes34.dll'),
(r'C:\Python34\Lib\site-packages\pywin32_system32\pythoncom34.dll', 'pythoncom34.dll'),]
build_exe_options = dict(
packages=['os', 'concurrent.futures', 'datetime', 'docopt', 'email.mime.text', 'configparser', 'enum',
'json', 'logging', 'psutil', 'requests', 'smtplib', 'socket', 'subprocess', 'sys', 'threading', 'time',
'wmi', 'pythoncom'],
excludes=[],
include_files=include_files)
executable = Executable(
script = 'pyWatch.py',
copyDependentFiles = True,
base = 'Console')
setup( name= "pyWatch",
version= "0.1",
options= {"build_exe": build_exe_options},
executables= [executable])
cx_freeze's output (too large to paste here): http://pastebin.com/2c4hUSeD
All help would be greatly appreciated!