【发布时间】:2020-08-24 15:09:28
【问题描述】:
我正在尝试将我的 .py 文件转换为 .exe。我在我的 .py 文件中使用 kivy。我意识到检测到致命错误。如果我使用 SoundLoader.load('test.wav'),则无法执行脚本主错误。 主.py:
from kivy.app import App
from kivy.core.audio import SoundLoader
from kivy.uix.screenmanager import ScreenManager
class Manager(ScreenManager):
sound = SoundLoader.load('test.wav')
sound.play()
class testapp(App):
def build(self):
return Manager()
if __name__ == '__main__':
testapp().run()
如果我运行我的 .py 文件,我会在 windows 和 linux 系统上听到声音。我按照以下步骤创建我的 exe:KIVY package for Windows。如果我不使用 SoundLoader 行,我的 exe 就会运行。但是如果我添加它,我什至无法打开控制台或应用程序,因为出现此错误。感谢您的建议。
【问题讨论】:
-
您是否在规范文件的
datas中包含test.wav? -
我将我的 .wav 添加到数据中。之后我收到此错误:File "kivy\lib\gstplayer_gstplayer.pyx",第 233 行,在 kivy.lib.gstplayer._gstplayer.GstPlayer.load kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin. 考虑将环境 GST REGISTRY 设置为用户可访问的路径,例如 ~/registry.bin ... [下一行:] [428] 无法执行脚本 main。
标签: python kivy exe pyinstaller