使用cx_Freeze時,我似乎無法使圖像正常工作。我試圖尋找另一種答案,發現here,但得到的錯誤:無法找到名爲文檔文件/目錄\影像\ robot_standing.fw.png如何在使用cx_Freeze時包含圖像?
這裏是我的setup.py文件:
from cx_Freeze import setup,Executable
includefiles = ['Documents\images\robotStanding_sprite.fw.png', 'Documents\images\dirt_block.fw.png','Documents\images\grass_block.fw.png','Documents\images\spikes.fw.png','Documents\images\title_image.fw.png']
includes = []
excludes = []
packages = []
setup(
name = 'Robot Game',
version = '0.1',
description = 'null',
options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
executables = [Executable('Robot Game.py')]
)
什麼我做錯了嗎?
路徑需要與setup.py相關。 –
@ThomasK他們是。文件是setup.py所在的文件夾,但我也嘗試了圖像。 – Alexdr5398
您需要將\ \轉義爲\\或僅使用/ –