解决matplotlib写入中文一劳永逸的方法

it2025-10-29  4

环境: matplotlib 3.3.2, ubantu18.04

解决方法:

1、下载SimHei字体2、将下载的字体放入cd /usr/share/fonts/中3、清除matplotlib的缓存remove ~/.cache/matplotlib4、修改matplotlib下的配置文件matplotlib/mpl-data/matplotlibrc

5、找到文件以下三部分修改进行修改: font.family : sans-serif font.sans-serif : SimHei axes.unicode_minus : False
最新回复(0)