报错:attributeerror: ‘FreeTypeFont‘ object has no attribute ‘getsize‘

在运行yolov5时,报错:attributeerror: 'FreeTypeFont' object has no attribute 'getsize'

在网上搜索的结果大部分给出字体不对。。。之类的答案,

但通过仔细研究,发现该报错的报错原因是版本问题

image

 

这是因为安装了新版本的 Pillow (10)删除了该getsize功能,降级到 Pillow 9.5 解决了该问题

pip install Pillow==9.5

posted @ 2026-01-09 10:50  滑板拉半挂  阅读(4)  评论(0)    收藏  举报