我考虑过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)。但由于某种原因,它没有。
我传递了什么参数才能识别鸡蛋内的文件?
答案 0 :(得分:3)
在您的源目录中解压缩egg模块,并在setup.py中添加package: [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])
答案 1 :(得分:0)
您可以尝试在您提供的页面中链接的PyInstaller 2.6分支。