1. 查看matplotlib配置文件
import matplotlib
print(matplotlib.matplotlib_fname())
Out:{your-matplotlib-installed-path}/mpl-data/matplotlibrc
2. 下載simhei字體
點擊下載simhei字體
3. 複製字體文件
將下載的字體文件複製到第一步顯示的目錄中的相對路徑
{your-matplotlib-installed-path}/mpl-data/fonts/ttf
4. 修改配置文件(matplotlibrc)中使用的字體
font.family : sans-serif
font.sans-serif : SimHei
axes.unicode_minus : False
5. 清除用戶目錄下的.cache/matplotlib文件夾
rm -rf ~/.cache/matplotlib