python - Kivi 未执行,因为未找到 PIL
问题描述
所以,我对 Kivy 进行了一些修改,但我无法让它工作,我现在只想不能在屏幕上显示,但我做不到。我不知道我在网上看到的代码是否有问题,或者是否有错误,或者我在安装时做错了什么。PD:我正在使用 Windows 和 Pycharm。
我尝试多次卸载并重新安装 Kivy 和 PIL 和 Pillow,在 app.py 中写入 import 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
解决方案
推荐阅读
- javascript - 即使我传入我的变量,车把也不会呈现
- visual-studio-code - 如何在 VSCode 中显示所有(-Wall)警告
- python - 我无法在 pythin 中计算这个游戏的尝试次数
- sql - 尝试计算 1 个查询中的绝对变化和百分比变化
- python - 为什么以及何时应该使用 stack() 和 unstack() 方法?
- python - 将值填充到非常依赖于索引的 numpy 数组中
- sqlite - 实体框架表不是在内存中使用 SQLite 生成的
- python - 从 RawReactionActionEvent (discord.py) 获取消息
- sql - SQL SELECT 将正斜杠和 \r\n 添加到结果字符串
- python - 打印出某些内容后覆盖一行