2012-08-02 118 views
1

我會如何將捆綁成一個exe文件,以及使用py2exe的代碼打包成exe文件?第三方庫和Py2exe

現在我用我的setup.py的代碼是

from distutils.core import setup 
import py2exe 

# equivalent command line with options is: 
# python setup.py py2exe --compressed --bundle-files=2 --dist-dir="my/dist/dir" --dll-excludes="w9xpopen.exe" 
options = {'py2exe': { 
      'compressed':1, 
      'bundle_files': 1, 
      'dist_dir': "exe/dist/dir" 
      'dll_excludes' }} 

setup(console=[''], options=options,zipfile = None) 

回答

2

在你options您可以添加屬性includes並添加庫的方式。示例:

options = { "py2exe": { 
       "includes": ["LIBRARY HERE", ...] 
      }} 

這包括Py2exe尚未找到的外部庫。如果我沒有記錯,Py2exe應該試圖找到它自己的依賴關係,並且它沒有發現你可以使用上面的方法。

我不知道庫結構,美麗的湯,因爲我已經沒有使用它,但一個例子是:

"includes": ["matplotlib.backends.backend_tkagg"]

+0

謝謝你,這是我需要什麼。 – Max00355 2012-08-02 03:26:40