python.exe在哪个文件_pythonexe文件中的images文件夹放在哪里?
我已經把我設計的python游戲轉換成了一個exe。運行exe本身會導致它閃爍然后關閉,這意味著發生了錯誤。從命令提示符運行它也會導致錯誤,但會記錄它:Cannot load image: Playfield.png
Couldn't open images\Playfield.png
這說明load_image塊失敗了。我以前沒有images目錄時遇到過這種情況。在
我試圖將images文件夾移到dist目錄。這是顯示的錯誤:
^{pr2}$
這是我第一次使用py2exe,所以我不太確定發生了什么。原始python文件本身,表_戰爭.py,按預期運行。在
如果有幫助的話,整個Table_Wars文件夾的位置在我的桌面上的一個名為Games的文件夾中(C:\Users\Oventoaster\Desktop\Games\Table_Wars)。我運行的是Windows7 32位操作系統。在
如有要求,這是輸出.txt我產生了:Folder PATH listing for volume OS
Volume serial number is 7659-4C9C
C:\USERS\OVENTOASTER\DESKTOP\GAMES\TABLE_WARS
build
bdist.win32
winexe
bundle-2.7
collect-2.7
ctypes
distutils
mime
encodings
logging
multiprocessing
dummy
pygame
threads
unittest
xml
parsers
temp
dist
images
這是設置.py我曾經轉換文件:from distutils.core import setup
import py2exe
setup(console=['Table_Wars.py'])
編輯:我嘗試使用完整的py2exe示例。這將創建exe,但給出相同的Cannot load image錯誤。試圖將images文件夾與exe放在同一個文件夾中會創建一個Runtime Error: The application requested the runtime to terminate it in an unusual way.
Slace Diamond建議的代碼縮寫形式阻止了py2exe找到Table_Wars.py:
從命令:running py2exe
*** searching for required modules ***
error: Table_Wars.py: No such file or directory.
setup和{}在同一目錄中。如果有幫助,我輸入完整的路徑python.exe以及設置.py. 在
編輯:我好像越來越近了。我把images目錄放在self.extra_datas中,現在我得到了:
Fatal Python error: (segmentation fault)This application has requested the runtime to terminate it in an unusual way. Please contact the application's suppourt team for more information
總結
以上是生活随笔為你收集整理的python.exe在哪个文件_pythonexe文件中的images文件夹放在哪里?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python ocr 识别中文pdf_轻
- 下一篇: python处理csv文件 sql_如何