mac系统,安装了matplotlib之后, 导入matplotlib.pyplot的时候报错

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly 
if Python is not installed as a framework. See the Python documentation for more information on installing Python as a
framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda
please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ
for more information.

说python不是作为框架安装的,从stackoverflow上面找到的解决办法,现记录一下
1. cd ~/.matplotlib

2. nano matplotlibbrc
3. 在打开的文件里加一行: backend : TkAgg

nano编辑器的使用:ctrl + x 保存退出, y确认保存,回车退出

4. 在python里,使用matplotlib.pyplot之前先执行以下两行代码:

In [1]: import matplotlib

In [2]: matplotlib.use("TkAgg")

然后再导入,import matplotlib.pyplot as plt

it works!

mac使用matplotlib的更多相关文章

  1. 第26月第7天 mac如何matplotlib中文乱码问题

    1.mac如何matplotlib中文乱码问题 先查看 ~/.matplotlib/fontList.json 添加SimHei字体(simhei.ttf文件)到 /Library/Framework ...

  2. 解决mac上matplotlib中文无法显示问题

    系统:mac os, high sierra; python3.7(by brew installed)   在网上找了很多基本上都是让下载SimHei字体,然后放到mac的matplotlib的字体 ...

  3. mac中matplotlib不支持中文的解决办法

    参考:https://blog.csdn.net/kaizei_pao/article/details/80795377 首先查看matplotlib已加载的字体: import matplotlib ...

  4. Mac下面 matplotlib 中文无法显示解决

    一.环境描述 python 3.7 mac 10.14.5 二.问题描述 如下图所示,当使用matplotlib绘制图片的时候,所有的中文字符无法正常显示. 三.解决方法 1.下载字体ttf文件 链接 ...

  5. python-learning-第二季-画图matplotlib

    https://www.bjsxt.com/down/8468.html 绘制方法: 绘制直线: #coding:utf- import matplotlib.pyplot as plt #准备绘制的 ...

  6. Mac下安装eclipse+python+pydev+numpy+matplotlib

    *本人亲测是成功的安装过程 1.更新Mac系统默认低版本的python2.7.请参见这篇文章:http://jingyan.baidu.com/article/14bd256e39b63dbb6d26 ...

  7. Mac中使用pycharm引包matplotlib失败

    最开始是使用matplotlib这个包,然后在pycharm中失败,然后在终端中pip install matplotlib,发现,安装了以后,pycharm依然找不到包. 代码如下: import ...

  8. matplotlib在MAC系统下中文字体显示问题

    最近想把部分python数据分析的代码从win系统迁移到MAC上,有部分图片上涉及中文显示,迁移到MAC上warning: UserWarning: findfont: Font family [u' ...

  9. mac pro下安装安装 SymPy 和 matplotlib报错解决方案

    因为自己写python分析时候要用到这两个库,但是mac 上安装不成功.原来是要安装原来装 matplotlib 之前先要安装 freetyp 和 libpng. brew install freet ...

随机推荐

  1. SQL Server中的日期,时间组合查询

    如图所示,Jdate和Jdate2是两个分开的字段,一个是date类型,存储日期,一个是time(0)类型,存储具体时间 现在有这样的要求,就是获得(Jdate和Jdate2组合起来的日期时间)在(当 ...

  2. JZOJ 5185. 【NOIP2017提高组模拟6.30】tty's sequence

    5185. [NOIP2017提高组模拟6.30]tty's sequence (Standard IO) Time Limits: 1000 ms  Memory Limits: 262144 KB ...

  3. A1083 List Grades (25)(25 分)

    A1083 List Grades (25)(25 分) Given a list of N student records with name, ID and grade. You are supp ...

  4. input type=file输入框

    <div class="row"> <!--选择图片按钮--> <div class="col-xs-12" align=&quo ...

  5. java十分钟速懂知识点——引用

    一.由健忘症引起的问题 今天闲来没事在日志中瞟见了个OutOfMemoryError错误,不由得想到前一段时间看到一篇面经里问到Java中是否有内存泄露,这个很久以前是留意过的,大体记得内存溢出和内存 ...

  6. python项目中输出指定颜色的日志

    起因 在开发项目过程中,为了方便调试代码,经常会向stdout中输出一些日志,默认的这些日志就直接显示在了终端中.而一般的应用服务器,第三方库,甚至服务器的一些通告也会在终端中显示,这样就搅乱了我们想 ...

  7. pip install 报错 Could not fetch URL

    Could not fetch URL https://pypi.python.org/simple/xxx/: There was a problem confirming the ssl cert ...

  8. mybatis是如何防止sql注入?

    sql注入发生的时间,sql注入发生的阶段在sql预编译阶段,当编译完成的sql不会产生sql注入 采用jdbc操作数据时候 String sql = "update ft_proposal ...

  9. ffmpeg转换参数和对几种视频格式的转换分析

    我们在将多种格式的视频转换成flv格式的时候,我们关注的就是转换后的flv视频的品质和大小.下面就自己的实践所得来和大家分享一下,主要针对avi.3gp.mp4和wmv四种格式来进行分析.通常在使用f ...

  10. iOS笔记052- Quartz2D-绘图

      简介 Quartz 2D是一个二维绘图引擎,同时支持iOS和Mac系统 Quartz 2D能完成的工作       绘制图形 : 线条\三角形\矩形\圆\弧等       绘制文字       绘 ...