Python:未安装_imagingft C模块
发布于 2021-01-29 14:57:42
我已经尝试了很多发布在网络上的解决方案,但是它们没有用。
>>> import _imaging
>>> _imaging.__file__
'C:\\python26\\lib\\site-packages\\PIL\\_imaging.pyd'
>>>
因此系统可以找到_imaging,但仍不能使用truetype字体
from PIL import Image, ImageDraw, ImageFilter, ImageFont
im = Image.new('RGB', (300,300), 'white')
draw = ImageDraw.Draw(im)
font = ImageFont.truetype('arial.ttf', 14)
draw.text((100,100), 'test text', font = font)
引发此错误:
ImportError: The _imagingft C module is not installed
File "D:\Python26\Lib\site-packages\PIL\ImageFont.py", line 34, in __getattr__
raise ImportError("The _imagingft C module is not installed")
关注者
0
被浏览
65
1 个回答
-
您安装的PIL编译时没有libfreetype。
您可以在此处获得PIL的预编译安装程序(与libfreetype一起编译)(以及许多其他预编译的Python C模块):