python cx_Freeze鸡蛋问题
作者:互联网
即时通讯试图从python脚本(使用大量鸡蛋)构建可执行文件(针对32位Windows XP)
我考虑了py2exe(0.6.9),PyInstaller(1.4)和cx_Freeze(4.1.2)
py2exe doesnt like eggs for breakfast
PyInstaller doesnt like python 2.6 for lunch)
所以我选择了cx_Freeze(supposed to support eggs seamlessly since 4.0).但由于某种原因,它没有.
我要传递什么参数才能识别鸡蛋中的文件?
解决方法:
在源目录中解压缩您的eggs模块,并在setup.py中添加包:[dependencies,].
在py2Exe Docs中的py2exe文档之后,我执行了您最常在源代码中运行的以下脚本:python unpackEgg.py eggsmodule:
import os
import pkg_resources
import sys
from setuptools.archive_util import unpack_archive
def unpackEgg(modulo):
eggs = pkg_resources.require(modulo)
for egg in eggs:
if os.path.isdir(egg.location):
sys.path.insert(0, egg.location)
continue
unpack_archive(egg.location, ".")
eggpacks = set()
eggspth = open("./eggs.pth", "w")
for egg in eggs:
print egg
eggspth.write(os.path.basename(egg.location))
eggspth.write("\n")
eggpacks.update(egg.get_metadata_lines("top_level.txt"))
eggspth.close()
eggpacks.clear()
if __name__ == '__main__':
unpackEgg(sys.argv[1])
标签:py2exe,cx-freeze,python,pyinstaller 来源: https://codeday.me/bug/20191210/2099481.html