Kivy 窗口无法加载

Kivy 窗口无法加载

我已经尝试使用 Kivy 一段时间了,但无论我使用多少策略,我仍然收到错误消息:

sdl2 - ImportError: DLL load failed: The specified module could not be found.

我正在使用带有 python 3.6 的 pycharm,所以我不知道这是否会影响任何事情,但我已经尝试了迄今为止在堆栈上能找到的所有解决方案,例如卸载并重新安装从 kivy + 依赖项到 pycharm 和 python 本身的所有内容...请帮忙!

完整的错误信息如下:

C:\Users\Brian\AppData\Local\Programs\Python\Python37\python.exe C:/Users/Brian/PycharmProjects/kivy/hi.py
[INFO   ] [Logger      ] Record log in C:\Users\Brian\.kivy\logs\kivy_19-01-22_21.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer 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\Brian\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\Brian\AppData\Local\Programs\Python\Python37\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.

Process finished with exit code 1

答案1

首先,你必须创建虚拟环境,进入控制台并输入以下命令 codekivy_venv\Scripts\activate

相关内容