成功解决OSError: cannot open resource File "F:Python36\lib\site-packages\PIL\ImageFont.py", self.font

简介: 成功解决OSError: cannot open resource File "F:Python36\lib\site-packages\PIL\ImageFont.py", self.font

解决问题


File "F:Python36\lib\site-packages\PIL\ImageFont.py", line 144, in __init__

  self.font = core.getfont(font, size, index, encoding, layout_engine=layout_engine)

OSError: cannot open resource



解决思路


self.font = core.getfont(font, size, index, encoding, layout_engine=layout_engine)

OSError:无法打开资源,

两个原因

T1、加载的字体文件路径不对!,很有可能是加载的文件名字过长,文件名过长也不行的!

T2、加载的字体文件有问题!



解决方法


1、先参考StackOverflow网友的解答:https://stackoverflow.com/questions/47694421/pil-issue-oserror-cannot-open-resource

相关文章
|
2月前
|
存储 编解码 API
python多种方法压缩图片,opencv、PIL、tinypng、pngquant压缩图片
python多种方法压缩图片,opencv、PIL、tinypng、pngquant压缩图片
47 1
|
2月前
|
API 开发工具 Python
【Azure Developer】使用 Azure Python SDK时,遇见 The resource principal named https://management.azure.com was not found in the tenant China Azure问题的解决办法
【Azure Developer】使用 Azure Python SDK时,遇见 The resource principal named https://management.azure.com was not found in the tenant China Azure问题的解决办法
|
2月前
|
Linux Python Windows
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
|
2月前
|
Python
python 升级后 yum 无法使用 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: `/usr/libexec/urlgrabber-ext-down`
python 升级后 yum 无法使用 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: `/usr/libexec/urlgrabber-ext-down`
14 0
|
3月前
|
UED Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’
77 0
|
3月前
|
程序员 开发者 Python
【Python】已解决:Traceback (most recent call last): File “C:/python/kfc.py”, line 8, in KfcError: KFC Cra
【Python】已解决:Traceback (most recent call last): File “C:/python/kfc.py”, line 8, in KfcError: KFC Cra
82 0
|
3月前
|
计算机视觉 Python
【Python】已解决:ModuleNotFoundError: No module named ‘PIL’
【Python】已解决:ModuleNotFoundError: No module named ‘PIL’
191 0
|
3月前
|
XML 数据格式 Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘./1.xml’
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘./1.xml’
86 0
|
3月前
|
API 计算机视觉 开发者
【Python】已解决:(pip安装PIL库报错) ERROR: Could not find a version that satisfies the requirement PIL (from v
【Python】已解决:(pip安装PIL库报错) ERROR: Could not find a version that satisfies the requirement PIL (from v
68 0
|
3月前
|
自然语言处理 Java 开发工具
【Python】已解决Resource averaged_perceptron_tagger not found. Please use the NLTK Downloader to obtain t
【Python】已解决Resource averaged_perceptron_tagger not found. Please use the NLTK Downloader to obtain t
85 0
下一篇
无影云桌面