問題描述
我看到的針對此 Kivy 錯誤的所有解決方案均不適用于我.現在已經有兩個多星期了,但我所有的努力都是徒勞的.我使用 python 3.6.4、kivy 1.10.1、pycharm 作為我的 IDE 和 Windows 10.這是錯誤代碼和代碼本身:
All the solutions that am seeing for this Kivy error does not work for me. It has been more tha 2 weeks now yet all my efforts are in vain. Am using python 3.6.4, kivy 1.10.1, pycharm as my IDE and Windows 10. here is the error code and the code itself:
代碼:
from kivy.core.window import Window
import os
os.environ['KIVY_GL_BACKEND'] = 'angel_sdl2'
from kivy.app import App
from kivy.uix.button import Button
# from kivy import Config
# Config.set('graphics', 'multisamples', '0')
class MyApp(App):
def build(self):
return Button(text='Hello world')
if __name__ == '__main__':
MyApp().run()
錯誤:
enter code here"C:Program FilesPython36-32python.exe"
"C:/Users/Sabinus O Ofoleta/Desktop/python/tested.py"
[INFO ] [Logger ] Record log in C:UsersSabinus O Ofoleta.kivylogskivy_19-02-21_4.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 12:45:02) [MSC v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 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
[INFO ] [Window ] Activate GLES2/ANGLE context
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - RuntimeError: b'Could not initialize EGL'
File "C:Program FilesPython36-32Libsite-packages kivycore\__init__.py", line 67, in core_select_lib
cls = cls()
File "C:Program FilesPython36-32Libsite-packages kivycorewindowwindow_sdl2.py", line 140, in __init__
super(WindowSDL, self).__init__()
File "C:Program FilesPython36-32Libsite-packageskivycorewindow\__init__.py", line 968, in __init__
self.create_window()
File "C:Program FilesPython36-32Libsite-packageskivycorewindowwindow_sdl2.py", line 272, in create_window
self.fullscreen,resizable , state)
File "kivycorewindow\_window_sdl2.pyx", line 209, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivycorewindow\_window_sdl2.pyx", line 66, in kivy.core.window._window_sdl2._WindowSDL2Storage.die
[CRITICAL] [App ] Unable to get a Window, abort.
Process finished with exit code 1
我的電腦使用的是 opengl 1.1,因為其他版本不兼容,所以我決定使用angel_sdl2".謝謝
My computer is using opengl 1.1 because other versions are not compatible so I dicided to use 'angel_sdl2'. Thanks
推薦答案
在 Intel GMA 965 和 Win10 的筆記本電腦上出現同樣的問題
Same issue on a laptop with Intel GMA 965 and Win10
原因:顯卡驅動過時,沒有新版本.
The reason: graphics driver is outdated, no new versions.
解決方案(對我有用):
1) 通過 pal1000 https://github.com/pal1000/save 應用工具-legacy-intel-graphics
1) Apply tool by pal1000 https://github.com/pal1000/save-legacy-intel-graphics
(更多信息請訪問 https://community.khronos.org/t/i-have-opengl-3-1-but-kivy-says-that-i-have-only-1-1/103980/6)
2) 安裝依賴,比如
python -m pip install --ignore-installed kivy.deps.sdl2 kivy.deps.glew
(并將系統變量KIVY_GL_BACKEND"設置為glew",或者不設置 - 這是默認值;順便說一句,安裝 kivy.deps.angle 并設置angle_sdl2"沒有幫助我在這種情況下)
(and set system variable "KIVY_GL_BACKEND" to "glew", or don't set - this is default value; btw installing kivy.deps.angle and setting "angle_sdl2" don't help me in this case)
3) 在python代碼前添加:
3) Add this before python code:
from kivy import Config
Config.set('graphics', 'multisamples', '0')
(來自 Kivy 未檢測到 OpenGL 2.0)
這篇關于Kivy 錯誤:[CRITICAL] [App] 無法獲取窗口,中止的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!