cx冻结不包括指定的文件

2024-06-13 23:15:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我用Python用tkinter和winsound构建了一个简单的声音板。soundboard使用一些.gif和.wav数据文件,这些文件与python脚本本身包含在同一个目录中。我写了以下内容设置.py使用cx冻结的文件:

import sys
from cx_Freeze import Executable, setup

build_exe_options = {'packages':['winsound', 'tkinter'], 'include_files':['battle.gif', 'Battle.wav', 'flag.gif', 'icon.ico', 'ocean.gif', 'Ocean.wav', 'shanty.gif', 'Shanty.wav', 'tavern.gif', 'Tavern.wav']}

base = None
if sys.platform == "win32":
   base = 'Win32GUI'

setup(name='Savage Worlds Soundboard',
  version='0.1',
  description='Soundboard for Pirates of the Spanish Main campaign',
  options = {'build.exe':build_exe_options},
  executables = [Executable("Savage_Worlds_Soundboard.py", base=base)]
  )

当我用python构建程序时设置.py在命令提示符下,它通常在目录中创建一个构建文件夹。但是,当我打开C:x\build\exe.win软件-amd64-3.4\Savage_Worlds_Soundboard(可执行文件),我得到以下错误:


^{pr2}$

有什么想法吗?在我看来,cx\u Freeze没有包括我在中指定的其他数据文件设置.py. 也许我写的安装文件不正确?在


Tags: 文件pybuildbasetkinter数据文件gifexe