美文网首页
pandas anaconda2 matplotlib 解决中文

pandas anaconda2 matplotlib 解决中文

作者: 邵红晓 | 来源:发表于2021-04-25 11:02 被阅读0次

    python

    plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
    plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
    

    1、cd anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data
    将C:\Windows\Fonts\simhei.ttf 上传到该目录
    2、chmod +x simhei.ttf
    3、修改配置 anaconda2/lib/python2.7/site-packages/matplotlib/mpl-data\matplotlibrc
    font.sans-serif : SimHei, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
    新增SimHei
    4、清除缓存 .rm -rf .cache/matplotlib
    5、执行python代码ok

    相关文章

      网友评论

          本文标题:pandas anaconda2 matplotlib 解决中文

          本文链接:https://www.haomeiwen.com/subject/lrhdrltx.html