Kivy没有打开新窗口

时间:2018-08-01 18:18:17

标签: kivy

当我尝试运行使用kivy的文件时,出现错误和一些行。 这是我跑步时的全部输出。

[INFO   ] [Logger      ] Record log in C:\Users\hrittik\.kivy\logs\kivy_18-08-01_1.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil, img_gif (img_sdl2, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Users\hrittik\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\hrittik\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\core\window\window_sdl2.py", line 26, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

请帮助

Import kivy.uix.button
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()

1 个答案:

答案 0 :(得分:0)

您需要安装sdl2。

Installation on Windows

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
     

对于Python 3.5+,您还可以使用斜角后端而不是倾斜。   可以通过以下方式安装:

python -m pip install kivy.deps.angle