首页 > 解决方案 > 带有 Hello World 的 Bionic 中的 Kivy 分段错误

问题描述

新的 Kivy 用户在这里...

我在仿生 Ubuntu 中运行 Kivy 时遇到问题。简单的 Hello World 应用程序引发分段错误。该窗口在设备屏幕上弹出,带有部分绘制:框架和标题栏,但没有背景,并立即消失,并在 kivy 控制台输出中出现分段错误。

我的安装是:

Python:

import os
print(os.path)
from kivy.app import App

class MyApp(App):
    pass

if __name__ == '__main__':
    MyApp().run()

我最初遇到“无法找到任何有价值的窗口提供程序”的问题。我不得不添加几个没有加载的必需包(主要是libsdl相关的),然后运行 ​​glxinfo 并使用最后一个 id (0x16a) 来更新环境:

export SDL_VIDEO_X11_VISUALID=0x16a

这让我摆脱了“没有有价值的窗口”的错误,但仍然没有快乐。现在它段故障。

我的Kivy 日志显示:

<module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>
[INFO   ] [Logger      ] Record log in /home/ubuntu/.kivy/logs/kivy_18-08-06_12.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0]
[INFO   ] [Factory     ] 194 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[DEBUG  ] [App         ] Loading kv <./my.kv>
[INFO   ] [Text        ] Provider: sdl2
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[DEBUG  ] [GL          ] glShaderBinary is not available
[INFO   ] [GL          ] Backend used <gl>
[INFO   ] [GL          ] OpenGL version <2.1 V6.2.2.93313>
[INFO   ] [GL          ] OpenGL vendor <Vivante Corporation>
[INFO   ] [GL          ] OpenGL renderer <Vivante GC2000>
[INFO   ] [GL          ] OpenGL parsed version: 2, 1
[INFO   ] [GL          ] Shading version <2.1.0 >
[INFO   ] [GL          ] Texture max size <8192>
[INFO   ] [GL          ] Texture max units <8>
[DEBUG  ] [Shader      ] Fragment compiled successfully
[DEBUG  ] [Shader      ] Vertex compiled successfully
[DEBUG  ] [ImageSDL2   ] Load </usr/lib/python2.7/dist-packages/kivy/data/glsl/default.png>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[DEBUG  ] [Resource    ] add </usr/share/fonts> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/ubuntu> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/dejavu> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/freefont> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/noto> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/cMap> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/X11> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/X11/misc> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/X11/util> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/X11/encodings> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/X11/encodings/large> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/cmap> in path list
[DEBUG  ] [Resource    ] add </usr/local/share/fonts> in path list
[DEBUG  ] [Resource    ] add </usr/lib/python2.7/dist-packages/kivy/data/fonts> in path list
[DEBUG  ] [Base        ] Create provider from mouse
[DEBUG  ] [Base        ] Create provider from probesysfs
[DEBUG  ] [ProbeSysfs  ] using probesysfs!
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[DEBUG  ] [Atlas       ] Load </usr/lib/python2.7/dist-packages/kivy/data/images/defaulttheme.atlas>
[DEBUG  ] [Atlas       ] Need to load 1 images
[DEBUG  ] [Atlas       ] Load </usr/lib/python2.7/dist-packages/kivy/data/images/defaulttheme-0.png>
[DEBUG  ] [ImageSDL2   ] Load </usr/lib/python2.7/dist-packages/kivy/data/images/defaulttheme-0.png>
Segmentation fault

问:接下来我应该寻找什么?我是否可以提供任何其他信息来帮助某人为我指明正确的方向?似乎我真的很接近但认为这是一个 GL 或 sdl 问题,因为我必须加载似乎没有出现在发行版中的包?

提前致谢。

标签: pythonubuntukivyubuntu-18.04

解决方案


推荐阅读