解决matplotlib中文显示乱码问题
问题
findfont: Generic family 'sans-serif' not found because none of the following families were found: SimHei
解决方法
import matplotlib
print(matplotlib.matplotlib_fname())
输出:xxx/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc
下载 http://129.204.205.246/downloads/SimHei.ttf
复制到 xxx/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf
python字体缓存文件
import matplotlib
print(matplotlib.get_cachedir())
rm -rf 输出的地址/*
本文来自博客园,作者:源世,转载请注明原文链接:https://www.cnblogs.com/jsxzhub/p/17767234.html