美文网首页
jupyter matplotlib 乱码

jupyter matplotlib 乱码

作者: smallcui | 来源:发表于2019-04-06 00:55 被阅读0次

    1. 查看 matplotlib 字体文件夹

    import matplotlib 
    print(matplotlib.matplotlib_fname()) 
    
    /usr/lib64/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
    

    2. 下载字体

    cd /usr/lib64/python3.6/site-packages/matplotlib/mpl-data/
    cd fonts 
     从这个 https://www.fontpalace.com/font-download/SimHei/ 网址下载字体
    

    3. 修改配置文件

    vim /usr/lib64/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
    去掉# 注释,修改成以下,font.sans-serif 加上SimHei

    font.family         : sans-serif       
    font.sans-serif     : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
    

    4. 删除缓存

    rm -rf ~/.cache/matplotlib 
    

    5. 重启jupyter,大功告成

    相关文章

      网友评论

          本文标题:jupyter matplotlib 乱码

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