Kivy-python:运行 Hello World 时出错

2022-01-15 00:00:00 python kivy

问题描述

安装 Kivy 后,我尝试运行 Hello World 应用程序,但出现错误.我用谷歌搜索但找不到满意的答案.这是错误:

After installing Kivy, I tried to run a Hello World app, but I get an error. I've google it but cannot find satisfied answer. Here is the error:

[INFO   ] Kivy v1.8.0
[INFO   ] [Logger      ] Record log in /home/duong/.kivy/logs/kivy_14-04-16_1.txt
[INFO   ] [Factory     ] 157 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif 
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[INFO   ] [Text        ] Provider: pygame
[DEBUG  ] [App         ] Loading kv <./my.kv>
[DEBUG  ] [App         ] kv <./my.kv> not found
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[WARNING] [WinPygame   ] Video: failed (multisamples=2)
[WARNING] [WinPygame   ] trying without antialiasing
[ERROR  ] [Window      ] Unable to use pygame
[ERROR  ] [Window      ] The module raised an important error: "Couldn't find matching   GLX visual"
 Exception kivy.core.CoreCriticalException: CoreCriticalException("Couldn't find matching GLX visual",) in 'kivy.properties.dpi2px' ignored
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[WARNING] [WinPygame   ] SDL wrapper failed to import!
[DEBUG  ] [Window      ] Ignored <sdl> (import error)
[DEBUG  ] [Window      ] Ignored <x11> (import error)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
[CRITICAL] [App         ] Unable to get a Window, abort.


解决方案

该错误通常是由于您的计算机的图形芯片非常差,或者显卡驱动程序差.您的卡和驱动程序必须支持 OpenGL ES 2 才能使 Kivy 应用程序正常工作.如果您在虚拟机中运行它,请确保您已为该虚拟机打开 3D 加速.

That error is usually due to your computer having a very poor graphics chip, or poor video card drivers. Your card and drivers must support OpenGL ES 2 for Kivy apps to work. If you are running this in a virtual machine, make sure you have turned on 3D acceleration for that VM.

相关文章