对于一个学校项目,我必须在 Raspberry pi 4 model B 上制作图形应用程序。
我用猕猴桃来做这个。我的代码没有问题。但是昨天,我遇到了一个错误(分段错误),当我使用过去版本的代码时,这个错误仍然存在。
我在这一行找到了错误。
from kivy.core.window import Window
当我只将这一行放入树莓派上的另一个 python 文件中时,会崩溃,但在我的电脑上不会崩溃。
我收到此错误。
[INFO ] [Logger ] Record log in /root/.kivy/logs/kivy_23-11-09_30.txt
[INFO ] [Kivy ] v2.2.1
[INFO ] [Kivy ] Installed at "/usr/local/lib/python3.9/dist-packages/kivy/__init__.py"
[INFO ] [Python ] v3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110]
[INFO ] [Python ] Interpreter at "/usr/bin/python3"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [Factory ] 190 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [Window ] Provider: x11(['window_sdl2'] ignored)
error: XDG_RUNTIME_DIR not set in the environment.
FBConfig selected:
Doublebuffer: Yes
Red Bits: 8, Green Bits: 8, Blue Bits: 8, Alpha Bits: 8, Depth Bits: 24
[INFO ] [GL ] Using the "OpenGL ES 2" graphics system
[INFO ] [GL ] Backend used <gl>
Segmentation fault
------------------
(program exited with code: 139)
Press return to continue
所以我不明白我能做些什么来解决这个问题。有人知道我能做什么吗?
对不起我的英语。
我尝试更新我的操作系统和 kivy 软件包,但没有任何变化。
如果我尝试像这样的简单代码可以正常工作:
print("test")
如果有人有想法。
我需要插入屏幕,我使用的是 VNC。
看起来 linux 在没有屏幕的情况下不会激活图形驱动程序。