0
下面的錯誤發生,如果我嘗試編譯我的Python(使用python 3.2)文件:Cx_Freeze編譯pygame的文件不起作用
Traceback(most recent call last):
File
"c:\python32\lib\site-packages\cx_Freeze\initscripts\Console3.py", line
27, in <module>
exec(code, m.__dict__)
File "Abertura.py", line 208, in <module>
File "Abertura.py", line 154, in main
File "Abertura.py", line 9, in __init__
pygame.error: Couldn't open
C:\Python32\build\exe.win32-3.2\library.zip\Imagens\menu1.png
我已經包含pygame._view並試圖複製「Imagens」目錄到library.zip文件,但它不起作用。我使用的圖像,以及音樂時,通過包括在我的代碼來自其他目錄中的視頻:
def file_path(filename, directory):
return os.path.join(
os.path.dirname(os.path.abspath(__file__)),
directory,
filename
)
這是我的setup.py文件:
from cx_Freeze import setup, Executable
exe=Executable(
script="Abertura.py",
base="Win32Gui",
)
includefiles=[('C:\Python32\Imagens', 'Imagens'),
('C:\Python32\Musicas','Musicas'),
('C:\Python32\Videos','Videos')
]
includes=[]
excludes=[]
packages=[]
setup(
version = "1.0",
description = "RPG",
author = "Pedro Forli e Ivan Veronezzi",
name = "Batalha Inapropriada",
options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
executables = [exe]
)
如何解決呢? (對不起,我可能會遇到英文錯誤)
你是從一個zip文件運行它們嗎?如果是這樣的話,這可能是問題。嘗試從所有外部文件和目錄複製到其中的文件夾運行它。 –
我不是,exe文件試圖從library.zip文件中提取圖像,視頻和音樂。 –