无法使用 Kivy 11.1.1 在 Raspberry4 (Buster) 上的 systemd 中启动 Kivy 应用程序。
我使用在 Raspberry4 (buster) 上运行的 Kivy 框架 11.1 编写了一个应用程序。当我从 cli 启动应用程序时,它运行良好
但是,在 systemd 中启动同一个应用程序时出现错误。看起来环境变量设置不正确。下面是一个插图 - 仅供参考,我在导入 kivy 之前在我的程序中添加了 os.system('env') 。
LANGUAGE=fr_FR.UTF-8
USER=asysclay
SHLVL=0
HOME=/home/asysclay
OLDPWD=/
PS1=(ENV)
LOGNAME=asysclay
JOURNAL_STREAM=8:52735
_=/home/asysclay/ASYSClay/ENV/bin/python
PATH=/home/asysclay/ASYSClay/ENV/bin:/home/asysclay/ASYSClay/ENV/bin:/home/asysclay/ASYSClay/asysclayscores/sbin:/bin:/usr/sbin:/usr/bin
INVOCATION_ID=f86a4183f7b840ff88e9aac0fe41c9ef
KIVY_WINDOW=sdl2
LANG=fr_FR.UTF-8
SHELL=/bin/bash
VIRTUAL_ENV=/home/asysclay/ASYSClay/ENV
PWD=/home/asysclay/ASYSClay/asysclayscores
[INFO ] [Logger ] Record log in /home/asysclay/.kivy/logs/kivy_19-09-06_79.txt
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "/home/asysclay/ASYSClay/ENV/local/lib/python2.7/site-packages/kivy/__init__.pyc"
[INFO ] [Python ] v2.7.16 (default, Apr 6 2019, 01:42:57)
[GCC 8.2.0]
[INFO ] [Python ] Interpreter at "/home/asysclay/ASYSClay/ENV/bin/python"
[WARNING] [Deprecated ] Python 2 Kivy support has been deprecated. The Kivy release after 1.11.0 will not support Python 2 anymore
[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
[INFO ] [Window ] Provider: sdl2(['window_egl_rpi'] ignored)
error: XDG_RUNTIME_DIR not set in the environment.
[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 pot
ential causes
sdl2 - RuntimeError: Could not initialize EGL
File "/home/asysclay/ASYSClay/ENV/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
cls = cls()
File "/home/asysclay/ASYSClay/ENV/local/lib/python2.7/site-packages/kivy/core/window/window_sdl2.py", line 152, in __init__
super(WindowSDL, self).__init__()
File "/home/asysclay/ASYSClay/ENV/local/lib/python2.7/site-packages/kivy/core/window/__init__.py", line 981, in __init__
self.create_window()
File "/home/asysclay/ASYSClay/ENV/local/lib/python2.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 224, 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