findfont: Generic family ‘sans-serif‘ not found because none of the following families were found: S

every blog every motto: You can do more than you think.
https://blog.csdn.net/weixin_39190382?type=blog

0. 前言

错误记录

findfont: Generic family 'sans-serif' not found because none of the following families were found: SimHei

1. 正文

1.1 问题

findfont: Generic family 'sans-serif' not found because none of the following families were found: SimHei

1.2 解决方法

  1. 删除缓存
import matplotlib as mpl
print(mpl.get_cachedir())

会输出类似如下地址,

/home/v/.cache/matplotlib

删除该地址中的文件

rm -r /home/v/.cache/matplotlib/*
  1. 下载字体
    点击下载
    放到~/.fonts目录下,若没有需创建一个
mkdir ~/.fonts
  1. 刷新

此步未执行,已成功

fc-cache -fv

参考

[1] https://zhuanlan.zhihu.com/p/566430362

猜你喜欢

转载自blog.csdn.net/weixin_39190382/article/details/131787199
今日推荐