python+mac+matplotlib 中文乱码问题完美解决,绝对简单

  网上搜索了很方法,都太麻烦了,其实只要这两步就可轻松解决

1. 编辑matplotlib下的文件,取消font.famliy ,font.sans-serif 前的#

vim /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc

  

2. 重新生成字体环境

from matplotlib.font_manager import _rebuild
_rebuild()

  搞定!

猜你喜欢

转载自www.cnblogs.com/cauwt/p/python_mac_matplotlib_font_cn.html
今日推荐