我在python上安装了kivy和pygame,并试图从教程中运行代码,但是它不起作用。我试图在Internet上找到解决方案,但这只会使错误消息更长。我什至尝试重新安装kivy,但仍然没有任何变化。
我试图在Internet上寻找解决方案,但这只会使错误消息更长。我什至尝试重新安装kivy,但仍然没有任何变化。
我将kivy和pygame安装到python并尝试运行此命令:
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text="fcguh")
if __name__ == "__main__":
MyApp().run()
它显示一条错误消息,提示“没有名为“ kivy”的模块”。
然后我尝试在Internet上找到解决方案,做了一些我想不起的事情,错误消息变成了这样:
[INFO ] [Kivy ] v1.11.0
[INFO ] [Kivy ] Installed at "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\pythonw.exe"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored)
[CRITICAL] [Text ] Unable to find any valuable Text 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\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\text\text_sdl2.py", line 13, in <module>
from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,
pil - ModuleNotFoundError: No module named 'PIL'
File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\text\text_pil.py", line 7, in <module>
from PIL import Image, ImageFont, ImageDraw
[CRITICAL] [App ] Unable to get a Text provider, abort.
>>>
我尝试重新安装kivy,以防万一我什么都没丢失但什么都没改变。有人可以帮忙吗?我有一个学校项目要完成。
谢谢。