无法找到模块&cx_Freeze__init __'

时间:2014-03-25 11:40:00

标签: python windows python-3.x cx-freeze

我正在尝试将我的Python项目转换为独立的可执行文件,以便在未安装Python的其他服务器上运行它。

使用的命令:

python setup.py build > build.log

当我尝试运行生成的exe时,它总是会发出以下错误消息:

zipimport.ZipImportError: can't find module 'cx_Freeze__init__'
Fatal Python error: unable to locate initialization module

Current thread 0x00000b8c (most recent call first):

我试图在setup.py模块中定义我在整个项目中使用的所有库,尽管这没有任何区别。

我还添加了要包含的DLL文件(described in the post cx-freeze doesn't find all dependencies)。

该项目由以下库组成(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)

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的输出(太大而无法粘贴):http://pastebin.com/2c4hUSeD

非常感谢所有帮助!

1 个答案:

答案 0 :(得分:0)

而不是2014年上次更新的cx_freeze 有一个名为pyinstaller的模块,它是2016年的最新版本更新 pyinstaller

也很容易使用pyinstaller myscript.py和bam

相关问题