2010-04-13 140 views
3

即时试图建立一个可执行文件(在32位的Windows XP)从一个Python脚本(使用大量鸡蛋)蟒蛇cx_Freeze蛋的问题

我认为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

您可以尝试PyInstaller的2.6分支,该分支在您提供的页面中链接。

2

在你的源代码目录下打开你的egg模块并在你的setup.py文件中添加package: [dependencies,]。 继py2exe文档中py2Exe Docs我这样做脚本,你最执行运行在你的源: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]) 
+0

Brillient!这与cx freeze和python 3.3一起工作,只需更改打印鸡蛋打印(鸡蛋) – 2014-01-19 09:31:49