0
点赞
收藏
分享

微信扫一扫

【Mac】 Jupyter notebook plt 中文乱码

念川LNSC 2022-04-22 阅读 60
python

报错:Font family [‘sans-serif’] not found. Falling back to DejaVu Sans Mac
解决办法:换自带的字体,不用SimHei

from matplotlib.font_manager import FontManager
fm = FontManager()
mat_fonts = set(f.name for f in fm.ttflist)
print(mat_fonts)
plt.rcParams['font.sans-serif'] = ['Songti SC']  # 用来正常显示中文标签
#plt.rcParams['font.family'] = ['sans-serif']
#图片显示中文
plt.rcParams['axes.unicode_minus'] =False #减号unicode编码
举报

相关推荐

0 条评论