Cx_Freeze构建不包含zip文件中的python库 [英] Cx_Freeze build is not including python libraries in zip file

查看:150
本文介绍了Cx_Freeze构建不包含zip文件中的python库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用cx_Freeze 5.0
时遇到问题:
Windows 10 LTSB x64
Python 3.4.4 x86
PyQt5
PyW​​in32 x86

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

在重新安装Windows10安装之前,此过程从未遇到任何问题...它运行良好,现在我不知道为什么会发生...

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 ...

当我冻结我的python应用程序(python setup.py构建)时,脚本正在将整个python库复制到python34.zip之外。
我在python34.zip中获得的唯一东西是* .pyc文件(仅此..但是很多)

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)

我不知道为什么它没有现在包括python库,但未找到任何选项/配置,它必须自动包括此内容...

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.. :)

注意:我的setup.py,简单的setup.py文件,没有从标准示例中复制任何内容,仅包含一个资产文件夹(正确复制了此文件夹。.没问题)

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)

谢谢!

cx_Freeze构建输出

推荐答案

升级到cx_Freeze 5.x后,我遇到了相同的问题(如果确实存在问题)。我相信它会在以下更改日志中提及: https://cx-freeze.readthedocs。 io / en / latest / releasenotes.html

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. 增加了对将软件包存储在文件系统中,而不是将zip文件存储在
    中。有许多软件包假设它们是在文件系统中找到的
    ,如果在zip文件中找到它们,则会产生
    奇怪的错误。 默认情况是现在将软件包存储在
    文件系统中,但是可以使用一种方法将软件包放置在zip文件中
    (如果已知将
    放置在zip文件中,则可以正常运行)。 (问题73)

  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)


(强调我的意思)
方法显然是在 https://cx-freeze.readthedocs.io/zh- /latest/distutils.html#build-exe ,特别是 zip_include_packages zip_exclude_packages 选项。

(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.

我最终将以下内容作为关键字参数传递给setup()调用,这对我来说解决了这个问题:

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": ""}},

这篇关于Cx_Freeze构建不包含zip文件中的python库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆