我正在try 运行一个简单的代码,使用PIL和Raspbian中的Python3.9中的自定义字体,但我无法通过此错误:
Traceback (most recent call last):
File "/home/pi/python/src/mintest.py", line 2, in <module>
font52 = ImageFont.truetype('fonts/Font.ttf', 52)
File "/home/pi/.local/lib/python3.9/site-packages/PIL/ImageFont.py", line 878, in truetype
return freetype(font)
File "/home/pi/.local/lib/python3.9/site-packages/PIL/ImageFont.py", line 875, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/home/pi/.local/lib/python3.9/site-packages/PIL/ImageFont.py", line 196, in __init__
if core.HAVE_RAQM:
File "/home/pi/.local/lib/python3.9/site-packages/PIL/ImageFont.py", line 70, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
这是在Raspbian中再现错误所需的最小代码:
from PIL import ImageFont
font52 = ImageFont.truetype('fonts/Font.ttf', 52)
这是我的系统信息
分销商ID:Raspbian
描述:Raspbian GNU/Linux 9.13(扩展)
版本:9.13
代号:拉伸
Python 3.9.6
我已经try 了我在这里看到的所有答案.