即使已安装所有依赖项,Kivy也会返回错误

时间:2018-07-29 09:39:02

标签: python python-3.x kivy kivy-language

由于此错误,我在尝试运行我的第一个kivy代码时遇到问题:

C:\Users\OnlyMe\PycharmProjects\sana\venv\Scripts\python.exe 
C:/Users/OnlyMe/PycharmProjects/sana/sana.py
[INFO   ] [Logger      ] Record log in C:\Users\OnlyMe\.kivy\logs\kivy_18-07-29_39.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) 
[MSC v.1914 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] [Text        ] Unable to find any valuable Text provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Users\OnlyMe\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\OnlyMe\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\text\text_sdl2.py", line 12, in <module>
from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,

pil - ModuleNotFoundError: No module named 'PIL'
  File "C:\Users\OnlyMe\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\OnlyMe\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.

Process finished with exit code 1

,这是我要运行的代码:     进口猕猴桃     kivy.require('1.10.1')

from kivy.app import App
from kivy.uix.button import Label

class HelloWorld(App):

    def build(self):
        return Label(text="hello world")


HelloWorld = HelloWorld()

HelloWorld.run()

我尝试卸载然后反复安装依赖项,但它仍然返回相同的错误。

顺便说一句,我遵循了有关如何从此处进行安装的说明:https://kivy.org/docs/installation/installation-windows.html

我的IDE是PyCharm,我的操作系统是64位Windows 10,以防万一。

在此先感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

您缺少应该安装的两个库。您的代码对我来说很好用,但是当我卸载这两个库时,我得到相同的错误,因此您需要安装它们。

pip install pillow
pip install kivy_deps.sdl2