[英]Py2exe bundling files into a single exe
我在讓Py2exe將所有文件捆綁到一個.exe中時遇到麻煩。 當我不將它們捆綁在一起時,對我來說效果很好。 所以這是我不將它們捆綁在一起時使用的setup.py
腳本,它始終有效:
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
生成的所有文件捆綁到一個可執行文件中。 我知道它可以做到。 還是有其他方法可以做到這一點?
僅僅從錯誤日志消息中,您可以確保test.py的最后一行以回車結尾后重試嗎? (在test.py的最后一行之后按Enter,然后再次保存)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.