[英]How to Fix Kivy Issue Sdl2 -import Error? (Already tried pip'ing it)
This is my code which I copied stright from the kivy website
to test the library.这是我从
kivy website
直接复制来测试库的代码。
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
TestApp().run()
I get this error我收到这个错误
C:\Users\Helquin\PycharmProjects\Reddit\ok\Scripts\python.exe C:/Users/Helquin/PycharmProjects/Reddit/Guiexample.py
[INFO ] [Logger ] Record log in C:\Users\Helquin\.kivy\logs\kivy_19-09-19_40.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.1.17
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.1.22
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\Helquin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "C:\Users\Helquin\PycharmProjects\Reddit\ok\Scripts\python.exe"
[INFO ] [Factory ] 184 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. 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 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\Helquin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\Helquin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\window\window_sdl2.py", line 27, in <module>
from kivy.core.window._window_sdl2 import _WindowSDL2Storage
[CRITICAL] [App ] Unable to get a Window, abort.
Process finished with exit code 1
I tried uninstalling and re-installing as mentioned in sdl2 - ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort post我尝试按照sdl2 中所述卸载并重新安装 - ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort post
I also tried to follow a video made this year in case I made some mistake but that didn't help.我还尝试关注今年制作的视频,以防我犯了一些错误,但这并没有帮助。
(I am using Pycharms, on a windows 10 (home) 64 bit, 16 Gb ram (我正在使用 Pycharms,在 windows 10(家庭)64 位,16 Gb 内存
So in case, anyone else has this issue, I just made it in pycharm then ran it straight from CMD.因此,以防万一,其他人有这个问题,我只是在 pycharm 中制作它,然后直接从 CMD 运行它。 Not sure why this works, but even the developers couldn't figure it out
不知道为什么会这样,但即使是开发人员也无法弄清楚
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.