ƘɌỈ*_*ƬƠƑ 5 python windows cx-freeze python-3.x
我正在尝试将我的Python项目转换为独立的可执行文件,以便在未安装Python的其他服务器上运行它.
使用的命令:
python setup.py build > build.log
Run Code Online (Sandbox Code Playgroud)
当我尝试运行生成的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):
Run Code Online (Sandbox Code Playgroud)
我试图在setup.py模块中的整个项目中定义我正在使用的所有库,尽管这没有任何区别.
我还添加了要包含的DLL文件(在帖子中描述cx-freeze没有找到所有依赖项).
该项目由以下库组成(输出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)
Run Code Online (Sandbox Code Playgroud)
内容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])
Run Code Online (Sandbox Code Playgroud)
cx_freeze的输出(太大而无法粘贴):http://pastebin.com/2c4hUSeD
非常感谢所有帮助!
小智 0
与 2014 年最新版本更新的 cx_freeze 不同,
有一个名为 pyinstaller 的模块,它是 2016 年
pyinstaller的最新版本更新
也很容易使用,只需 pyinstaller myscript.py 和 bam
| 归档时间: |
|
| 查看次数: |
2386 次 |
| 最近记录: |