美文网首页
解决Matplotlib中文显示乱码

解决Matplotlib中文显示乱码

作者: 音符纸飞机 | 来源:发表于2019-01-12 23:09 被阅读11次
1.找到matplotlib的配置文件文件matplotlibrc
import matplotlib
matplotlib.matplotlib_fname()
2. 配置文件中的下面两行前的井号删去,simhei对应黑体
font.family         : sans-serif
font.sans-serif     : simhei, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, L....
3.将系统的黑体字体或其他字体(.ttf结尾的字体)复制到...\matplotlib\mpl-data\fonts\ttf目录中,必须与配置文件相对应
4.清空C:\users<用户>\.matplotlib目录

相关文章

网友评论

      本文标题:解决Matplotlib中文显示乱码

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