python Kivy未执行,因为未找到PIL

gijlo24d  于 2023-04-10  发布在  Python
关注(0)|答案(1)|浏览(95)

所以,我修修补补与Kivy位,但我不能使它工作,我只想能够启动一个屏幕现在,但我无法做到这一点.我不知道如果代码我一直在网上看到的是坏的,或者如果有一个错误或我做了一些错误的安装时. PS:我用的是Windows和PyCharm。
我已经多次尝试卸载和重新安装Kivy、PIL和Pillow,在app.py中写入import PILPillow

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
brccelvz

brccelvz1#

你只需要用pip在你的virtualenv中安装足够的依赖:

pip install sdl2-lib pillow

相关问题