解决ubantu里面报错findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans

  1. 在终端python 的环境下,查看字体路径
import matplotlib    
print(matplotlib.matplotlib_fname())
  1. 下载simhei.ttf ,放到指定目录下,例如我的目录为: /home/muli/anaconda3/lib/python3.5/site-packages/matplotlib/mpl-data/fonts/ttf
  2. 在home目录下,执行 ctrl + h ,打开隐藏目录, 删除 ~/.cache/matplotlib的缓冲目录
  3. 修改/home/muli/anaconda3/lib/python3.5/site-packages/matplotlib/mpl-data 里面的matplotlibrc文件,修改如下:
    font.family         : sans-serif        
    font.sans-serif     : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif 
    axes.unicode_minus,将True改为False,作用就是解决负号'-'显示为方块的问题   
  1. 如果没有效果,可能需要开机重启
  2. 参考博客:http://wenda.chinahadoop.cn/question/6828以及 https://blog.csdn.net/dgatiger/article/details/50414549
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值