我一直在尝试从kivy网站上运行“ hello world”测试代码,但似乎无法正常工作。我正在使用运行Python 3.7的PyCharm 2018 1.4x64,并且已经安装了Kivy(1.10.1)的最新版本
我已经按照kivy安装说明的每个步骤进行操作,卸载并重新安装了所有软件包(使用pip),并且kivy网站确实说支持python 3.7。
任何解决此问题的帮助将不胜感激!我花了很多时间来调试它,阅读了数十个论坛,多次安装,卸载并重新安装了所有内容,安装了枕头并向PATH添加了新目录,但没有任何效果。不知道还有什么尝试。
这是我要运行的代码:
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
TestApp().run()
这是我得到的输出:
C:\Users\gkubi\venv\Scripts\python.exe "C:/Users/gkubi/Desktop/My Programming/Python Programs/Kivy/test"
[INFO ] [Logger ] Record log in C:\Users\gkubi\.kivy\logs\kivy_18-07-14_3.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
[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\gkubi\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\gkubi\AppData\Local\Programs\Python\Python37-32\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
还要更新,我卸载并删除了Python 3.7,删除了所有与Python和Kivy相关的东西的用户AppData文件夹/文件,安装了Python 3.6.6,再次安装了Kivy及其依赖项这里的指示:https://kivy.org/docs/installation/installation-windows.html,分别将我的PATH更新为Python 3.6.6,并且仍然出现相同的错误。