Spyder “Glyph 24066 missing from current font.“报错问题

在使用spyder完成Matplotlib模块实现数据可视化时出现Glyph *** missing from current font。错误问题,经查阅资料综合网上给出的解决方案,总结如下:

问题原因:matplotlib自带的字体库不支持中文

第一步:下载中文字体包

常用的中文字体为:SimHei

给出一下链接可选择:

https://github.com/StellarCN/scp_zh/blob/master/fonts/SimHei.ttf

http://www.xiazaiziti.com/210356.html

https://www.wfonts.com/font/simhei

第二步:将下载的中文字体包拷贝到matplotlib的字体库中

如何查看matplotlib字体库路径:

1.首先使用matplotlib_fname函数找到对应的安装包所在位置,方法如下:


import matplotlib
 
print(matplotlib.matplotlib_fname()) 

Spyder “Glyph 24066 missing from current font.“报错问题_第1张图片

2.在得到的路径后添加/fonts/ttf,即可得到matplotlib字体库的路径为

D:\anaconda3\Lib\site-packages\matplotlib\mpl-data\fonts\ttf

将所下载的字体包中:SimHei.ttf文件拷贝到该路径下

第三部:修改matplotli

你可能感兴趣的:(大数据,python)