Я пытаюсь запустить приложение Kivy на моем Raspberry Pi 4, но когда я его запускаю, оно возвращает:
[CRITICAL] [Window ] Unable to find any valuable Window provider.
Я использовал https://github.com/kivy/kivy/blob/master/doc/sources/installation/installation-rpi.rst#raspberry -pi-1-4-Installation для установки среды.
Как это исправить?
Версии
- Python: 3.7.3
- ОС: Raspbian GNU / Linux 10 (бастер)
- Kivy: v2.0.0rc1
- Cython: 0.29.10
- sdl2, et c. установлено
Мой код
#! /usr/bin/python3
import os
os.environ['KIVY_VIDEO']='ffpyplayer'
os.environ['KIVY_WINDOW'] = 'sdl2'
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
Результат
[INFO ] [Logger ] Record log in /home/pi/.kivy/logs/kivy_20-01-30_13.txt
[INFO ] [Kivy ] v2.0.0rc1, git-Unknown, 20200130
[INFO ] [Kivy ] Installed at "/home/pi/.local/lib/python3.7/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.2.0]
[INFO ] [Python ] Interpreter at "/usr/bin/python3"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2(['text_pango'] ignored)
[INFO ] [Window ] Provider: sdl2
[CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - RuntimeError: b''
File "/home/pi/.local/lib/python3.7/site-packages/kivy/core/__init__.py", line 70, in core_select_lib
cls = cls()
File "/home/pi/.local/lib/python3.7/site-packages/kivy/core/window/window_sdl2.py", line 152, in __init__
super(WindowSDL, self).__init__()
File "/home/pi/.local/lib/python3.7/site-packages/kivy/core/window/__init__.py", line 981, in __init__
self.create_window()
File "/home/pi/.local/lib/python3.7/site-packages/kivy/core/window/window_sdl2.py", line 290, in create_window
self.get_gl_backend_name())
File "kivy/core/window/_window_sdl2.pyx", line 112, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy/core/window/_window_sdl2.pyx", line 74, in kivy.core.window._window_sdl2._WindowSDL2Storage.die
[CRITICAL] [App ] Unable to get a Window, abort.
Спасибо:)