本文介绍了Kivy sdl2-RuntimeError:b'无法初始化EGL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在带有OpenGL 1.1的Windows 7上运行以下示例脚本:

I try to run the following sample script on Windows 7 with OpenGL 1.1:

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 C:\Users\Admin.kivy\logs\kivy_20-03-09_20.txt 
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.2.0 
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.2.0 
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0 
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.2.0 
[INFO ] [Kivy ] v1.11.1 
[INFO ] [Kivy ] Installed at "F:\Data_analytics\venv\lib\site-packages\kivy_init_.py" 
[INFO ] [Python ] v3.6.0 (default, Jan 23 2017, 17:35:20) [MSC v.1900 32 bit (Intel)] 
[INFO ] [Python ] Interpreter at "F:\Data_analytics\venv\Scripts\python.exe" 
[INFO ] [Factory ] 184 symbols loaded 
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored) [INFO ] [Text ] Provider: sdl2 
[INFO ] [Window ] Provider: sdl2 
[INFO ] [Window ] Activate GLES2/ANGLE context 
[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'Could not initialize EGL' File "F:\Data_analytics\venv\lib\site-packages\kivy\core_init_.py", line 71, in core_select_lib cls = cls() File "F:\Data_analytics\venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 152, in init super(WindowSDL, self).init() File "F:\Data_analytics\venv\lib\site-packages\kivy\core\window_init_.py", line 981, in init self.create_window() File "F:\Data_analytics\venv\lib\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

[CRITICAL] [App ] Unable to get a Window, abort.

我使用了用户环境变量KIVY_GL_BACKEND,其值是angel_sdl2.

I have used user environment variable KIVY_GL_BACKEND with value angel_sdl2.

任何想法我该如何纠正并获得成功的结果?

Any idea what should i correct and get a successful result?

推荐答案

如果您使用pip安装了kivy,请尝试执行此操作

Try doing this if you installed kivy with pip

python -m pip uninstall kivy
python -m pip uninstall kivy.deps.sdl2
python -m pip uninstall kivy.deps.glew
python -m pip uninstall kivy.deps.gstreamer

现在重新安装除gstreamer之外的所有内容.

Now reinstalling everything except gstreamer.

python -m pip install --upgrade pip wheel setuptools
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 
kivy.deps.glew --extra-index-url https://kivy.org/downloads/packages/simple/
python -m pip install kivy

https://github.com/kivy/kivy/issues/6071

在安装步骤之后,您可以改为使用conda(我个人更喜欢这样做).

You could use conda instead after installation step(I personally prefer this).

conda install -c evindunn pygame
conda install -c conda-forge kivy

这篇关于Kivy sdl2-RuntimeError:b'无法初始化EGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 23:49