Cx_Freeze build is not including python libraries in zip file

拈花ヽ惹草 提交于 2019-12-11 06:24:14

问题


I'm in trouble with cx_Freeze 5.0 I'm working on: Windows 10 LTSB x64 Python 3.4.4 x86 PyQt5 PyWin32 x86

I never had any issue with this process until I reinstall my Windows10 installation... it was working great and now I can't figured it out why it's happening ...

When I Freeze my python app (python setup.py build) script is copying the whole python libraries outside the python34.zip. The only thing I got inside python34.zip is *.pyc files (only this.. but a lot)

I don't know why it doesnt include python libraries now and didnt find any options/config, it has to include this automatically ...

If someone can help with this.. :)

Note: nothing has changed in my setup.py, simple setup.py file, copied from standard example just including one asset folder (this one is correctly copied.. no issues)

Thanks !

cx_Freeze build output


回答1:


I encountered the same problem (if it is indeed a problem) after upgrading to cx_Freeze 5.x. I believe it's mentioned in the changelog here: https://cx-freeze.readthedocs.io/en/latest/releasenotes.html

  1. Added support for storing packages in the file system instead of in the zip file. There are a number of packages that assume that they are found in the file system and if found in a zip file instead produce strange errors. The default is now to store packages in the file system but a method is available to place packages in the zip file if they are known to behave properly when placed there. (Issue #73)

(emphasis mine) That "method" is apparently described in https://cx-freeze.readthedocs.io/en/latest/distutils.html#build-exe, specifically the zip_include_packages and zip_exclude_packages options.

I ended up putting the following as a keyword argument to my setup() call, which solved it for me:

options = {"build_exe": {"include_msvcr": True, "include_files": dataFiles, "packages": ["lxml", "idna"], "zip_include_packages": "*", "zip_exclude_packages": ""}},


来源:https://stackoverflow.com/questions/42143569/cx-freeze-build-is-not-including-python-libraries-in-zip-file

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