笔者在第一次安装matplotlib后运行时出现报错。

 import matplotlib as mlb
 from matplotlib import pylab as pl

 x = [1,3,5,7,6,9,10,13,16]
 y = [3,4,5,7,9,0,1,2,3]

 pl.plot(x,y)
 pl.show()

报错内容

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.

解决方法:

1、 打开终端,输入cd ~/.matplotlib

2、新建文件,vi matplotlibrc

3、文件中添加内容,按下i键,然后输入内容 backend: TkAgg ,然后点击esc,输入:号,输入wq,然后回车确定

4、重新运行脚本

结果如下:

最新文章

  1. 回溯法求n的全排列
  2. java Double封装类的对象保留两位小数
  3. sql server Geometry 类型操作 笔记
  4. EF 的 霸气配置
  5. Qt中文乱码问题(比较清楚,同一个二进制串被解释成不同的语言)
  6. zabbix之1监控概念
  7. SSIS: Lookup组件高级用法,生成推断成员(inferred member)
  8. c++ 输出虚函数表内容
  9. 2008r2 显示桌面图标
  10. Java并发编程:同步锁、读写锁
  11. javascript属性操作
  12. [Cpp] 面向对象程序设计 C++
  13. aspnet core2中使用csp内容安全策略
  14. shiro登录认证
  15. MySQL程序端启动密码错误解决方法
  16. Caused by: java.lang.ClassNotFoundException: Cannot find class解决办法
  17. Webstorm/IntelliJ Idea 过期破解方法
  18. Nodejs 第一站
  19. [2017BUAA软工助教]学期总结
  20. 使用feof()判断文件结束时会多输出内容的原因

热门文章

  1. LeetCode之“字符串”:ZigZag Conversion
  2. Android BLE与终端通信(四)——实现服务器与客户端即时通讯功能
  3. 快速熟悉Oracle索引
  4. 在Eclipse 中集成SVN
  5. azkaban的安装部署
  6. Java——接口
  7. JMS(Java平台上的专业技术规范)
  8. Day24 中间件 自定义分页 ModelForm 序列化 缓存 信号
  9. 在VirtualBox中的Ubuntu中添加新硬盘
  10. ubuntu11.04安装nginx+php+mysql