我有一些麻煩讓Py2exe捆綁所有的文件到一個單一的.exe。當我不把它們捆綁在一起時,它適用於 。因此,這是setup.py
劇本時,我沒有捆綁在一起我用,而且它始終工作:Py2exe捆綁文件到一個單一的exe
from distutils.core import setup
import py2exe
setup(console=['test.py'])
,所以我想所有的文件打包成一個可執行的,所以我用這個setup.py
腳本,這,並且這是不起作用的:
from distutils.core import setup
# I took this off the Internet
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "test.py"}],
zipfile = None,
)
當我運行此腳本時,將使用test.exe文件創建一個dist目錄。如果我通過鍵入執行它 「TEST.EXE」此錯誤信息彈出:
See the logfile 'c:\Python26\dist\test.ext.log' for details
這是日誌文件的內容:
Traceback (most recent call last):
File "test.py", line 1, in <module>
EOFError: EOF when reading a line
因此,沒有人知道我可以做到這一點?我只想將Py2exe生成的 和test.py
的所有文件打包成一個可執行文件。我知道它可以做到這一點。或者還有其他方式可以做到這一點嗎?
我強烈推薦[PyInstaller](http://www.pyinstaller.org/) – jterrace