Kivy windows 运行下报错 Unable to get a Window, abort.

只写了一个测试的脚本:

 import kivy
kivy.require(‘1.0.7’)

from kivy.app import App

class TestApp(App):
pass

if __name__ == ‘__main__’:
TestApp().run()

 

运行报错:

[INFO ] [Logger ] Record log in C:\Users\king\.kivy\logs\kivy_18-09-13_42.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 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
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 – ImportError: DLL load failed: �Ҳ���ָ����ģ�顣
File "D:\soft\Python27\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
cls = cls()
File "D:\soft\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
super(WindowSDL, self).__init__()
File "D:\soft\Python27\lib\site-packages\kivy\core\window\__init__.py", line 968, in __init__
self.create_window()
File "D:\soft\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 272, in create_window
self.fullscreen, resizable, state)
File "kivy\core\window\_window_sdl2.pyx", line 125, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name
File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name
File "D:\soft\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)

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

这个错误是我已经安装了 sdl2 了。

其实就是缺模块。安装下就好

pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

装好即可。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注