在使用matplotlib绘图时,会出现中文变成方框的问题
2. 登陆Jupyter Hub 服务器(我的是centos),切换至以下路径
cd /opt/module/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data3. 进入fonts目录,并下载simhei.ttf
cd mpl-data/fonts/ttf wget wget http://a.xzfile.com/down3/simhei_downcc.com.zip unzip simhei_downcc.com.zi 修改matplotlibrc文件,在文件末尾加入以下代码 cd ../.. vim matplotlibrc font.family : sans-serif font.sans-serif : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif axes.unicode_minus : False :q! 删除本账户下的缓存文件 cd /home/XXXXX/.cache/matplotlib #把 XXXX 替换成当前使用账户 rm -rf * 重启本账户jupyter hub 服务