OSError: cannot open resource ImageFont.py 解决方法

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

方案:字体文件路径  字体文件名不能改名(保持原名)

posted @   myrj  阅读(208)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2022-04-16 分布式hashcat
2022-04-16 手机浏览器找cookie
2022-04-16 Nullsoft PiMP Stub [Nullsoft PiMP SFX] * 脱壳
2022-04-16 C语言:排序函数(正序 倒序)
2021-04-16 c语言:getchar() getch()回显
2020-04-16 WORD加目录
点击右上角即可分享
微信分享提示