2010-04-13 103 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