Traceback (most recent call last):
File "C:/python37/pla.py", line 7, in <module>
newfont=ImageFont.truetype('./songti.ttc',60) # Songti.ttc 代表字体,60 代表字号
File "C:\python37\lib\site-packages\PIL\ImageFont.py", line 853, in truetype
return freetype(font)
File "C:\python37\lib\site-packages\PIL\ImageFont.py", line 850, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "C:\python37\lib\site-packages\PIL\ImageFont.py", line 211, in __init__
self.font = core.getfont(font, size, index, encoding, layout_engine=layout_engine)
OSError: cannot open resource
方案:字体文件路径 字体文件名不能改名(保持原名)
标签:OSError,resource,py,ImageFont,python37,File,line,font From: https://www.cnblogs.com/xkdn/p/17322525.html