matplotlib在mac上的中文乱码问题
来源:互联网 发布:微道网络推广团队 编辑:程序博客网 时间:2024/06/08 17:34
通过matplotlib.rcParams(‘font.sans-serif’) = ‘SimHei’运行后出现以下报错,
font_manager.py:1287: UserWarning: findfont: Font family [u’sans-serif’] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
并且还是有方块,不显示正常汉字,可以通过添加simhei.tff文件以及修改matplotlibbrc配置文件来解决
首先进入目录 /Users/loukun/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data通过命令vim修改。
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,将True改为False,作用就是解决负号’-‘显示为方块的问题
修改完文件后按保存退出
然后在网上下载simhei.tff文件或者在Windows系统中的fonts目录下拷贝simhei.tff文件,
将其拷贝到/Users/loukun/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/fonts目录下面
然后就是删除缓存了
直接上命令
rm -rf ~/.matplotlib/*.cache
该命令在那个目录下运行其实都可以。
然后在重新运行就没问题了。
- matplotlib在mac上的中文乱码问题
- Mac系统彻底解决matplotlib中文显示乱码的问题
- Mac 下matplotlib中文乱码问题
- 在html上中文乱码的问题
- Matplotlib中文乱码问题的解决办法
- matplotlib的lable中文乱码问题
- 解决mac上matplotlib(plot)无法显示中文的问题 (Python)
- mac上mysql中文乱码问题
- 彻底解决matplotlib中文乱码问题
- matplotlib 中文标签乱码问题
- 解决matplotlib中文乱码问题
- 彻底解决matplotlib中文乱码问题
- python matplotlib中文乱码问题
- 彻底解决matplotlib中文乱码问题
- 彻底解决matplotlib中文乱码问题
- 解决matplotlib中文乱码问题
- matplotlib解决中文乱码问题
- matplotlib解决中文乱码问题
- Retrofit2的简单使用
- 使用npm管理andular
- zz
- MySQL-电商数据建表
- sublime Text安装Bootstrap 3 Snippets
- matplotlib在mac上的中文乱码问题
- ubuntu python lxml安装
- angular简介
- 数据结构实验之图论二:图的深度遍历
- 安装类型文件
- 理解容器之间的连通性(涉及iptables、router、ip forwarding)
- Shrio 多realms集成:No realms have been configured! One or more realms must be present
- 批处理文件.bat中echo off和echo on的作用
- 什么是spa