方法1隐解,root態(tài)安裝
- 停止Jupyter
- 安裝 font-manager:
sudo apt install font-manager
- 清除matplotlib cache directory:
rm ~/.cache/matplotlib -fr
- 重啟Jupyter.
方法2,用戶態(tài)安裝
1. 查找matplotlib路徑
import matplotlib
matplotlib.matplotlib_fname()
輸出路徑大致如下,記住场勤,第2步會使用:
'xxx/matplotlib/mpl-data/matplotlibrc'
2. 安裝SimHei字體
字體鏈接:百度網(wǎng)盤 密碼:5vn4
字體放到xxx/matplotlib/mpl-data/ttf
下即可
3. 修改配置文件
vim 打開xxx/matplotlib/matplotlibrc
,添加內容如下:
4. 刪除緩存
rm ~/.cache/matplotlib -fr
重啟jupyter即可票灰。