Kivi未执行,因为未找到PIL

时间:2019-11-07 13:20:45

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

所以,我想对Kivy进行一些修改,但我无法使其正常工作,我只希望现在能够对屏幕进行分割,但我无法这样做。我不知道我在网上看到的代码是否错误,或者是否有错误,或者安装时做错了什么。 PD:我正在使用Windows和Pycharm。

我尝试多次卸载和重新安装Kivy,PIL和Pillow,并在app.py中编写了导入PIL和Pillow。

import os
import kivy
from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):
    def build(self):
        return Label(text="Hello")


if __name__ == "__main__":
    MyApp().run()

这是它给我的错误:

[INFO   ] [Logger      ] Record log in C:\Users\j\.kivy\logs\kivy_19-11-07_20.txt

[INFO   ] [Kivy        ] v1.11.1

[INFO   ] [Kivy        ] Installed at "C:\Users\j\Documents\PycharmProjects\Python_Test\venv\lib\site-packages\kivy\__init__.py"

[INFO   ] [Python      ] v3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]

[INFO   ] [Python      ] Interpreter at "C:\Users\j\Documents\PycharmProjects\Python_Test\venv\Scripts\python.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\j\Documents\PycharmProjects\Python_Test\venv\lib\site-packages\kivy\core\__init__.py", line 62, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\j\Documents\PycharmProjects\Python_Test\venv\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\j\Documents\PycharmProjects\Python_Test\venv\lib\site-packages\kivy\core\__init__.py", line 62, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\j\Documents\PycharmProjects\Python_Test\venv\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

0 个答案:

没有答案