gpt4 book ai didi

python - Cx_Freeze 构建不包括 zip 文件中的 python 库

转载 作者:行者123 更新时间:2023-12-02 04:00:31 25 4
gpt4 key购买 nike

我在使用 cx_Freeze 5.0 时遇到了麻烦我正在尝试:Windows 10 LTSB x64Python 3.4.4 x86PyQt5PyWin32 x86

在重新安装 Windows10 之前,我从未遇到过此过程的任何问题...它运行良好,但现在我无法弄清楚为什么会发生这种情况...

当我卡住我的 python 应用程序(python setup.py build)时,脚本正在将整个 python 库复制到 python34.zip 之外。我在 python34.zip 中得到的唯一东西是 *.pyc 文件(只有这个......但是很多)

我不知道为什么它现在不包含 python 库,也没有找到任何选项/配置,它必须自动包含它......

如果有人可以帮忙解决这个问题..:)

注意:我的 setup.py 中没有任何变化,简单的 setup.py 文件,从标准示例复制而来,仅包括一个 Assets 文件夹(此文件夹已正确复制..没有问题)

谢谢!

cx_Freeze build output

最佳答案

升级到cx_Freeze 5.x后,我遇到了同样的问题(如果确实是问题的话)。我相信这里的变更日志中提到了这一点: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)

(强调我的)https://cx-freeze.readthedocs.io/en/latest/distutils.html#build-exe 中显然描述了该“方法”。 ,特别是 zip_include_packageszip_exclude_packages 选项。

我最终将以下内容作为关键字参数添加到我的 setup() 调用中,这为我解决了这个问题:

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

关于python - Cx_Freeze 构建不包括 zip 文件中的 python 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42143569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com