MacOs + Virtualenv + ipython notebook下使用matplotlib
来源:互联网 发布:淘宝直通车钱可以退吗 编辑:程序博客网 时间:2024/06/06 23:53
0.错误
在MacOs + Virtualenv + ipython notebook下使用matplotlib的时候会出现如下错误
**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.
1.解决办法
修改matplotlib的backend,改成TkAgg
$ cd ~/.matplotlib$ vim matplotlibrc然后在文件里加入一行:backend: TkAgg
另一种方法是
import matplotlib as mptmpt.use('TkAgg')
参考:http://stackoverflow.com/questions/29433824/unable-to-import-matplotlib-pyplot-as-plt-in-virtualenv
2.在ipython notebook里面绘图
直接绘图会在弹出窗口里面绘图,在代码里加上
%matplotlib inline
3.最终
总的来说,按照如下方式import
import matplotlib as mplmpl.use('TkAgg')import matplotlib.pyplot as plt%matplotlib inline
0 0
- MacOs + Virtualenv + ipython notebook下使用matplotlib
- virtualenv 下使用ipython
- Ubuntu下安装numpy matplotlib scikit-learn ipython-notebook
- Windows 下 IPython NoteBook,pip使用
- windows下ipython notebook初次使用记录
- ipython notebook使用
- ipython notebook使用
- IPython Notebook的使用
- ipython notebook使用教程
- ipython notebook使用教程
- IPython Notebook使用实例
- ipython notebook使用教程
- ipython notebook使用教程
- IPython NoteBook 的使用
- ipython notebook使用教程
- 使用ipython %matplotlib inline
- Mac下iPython-notebook搭建及使用
- Mac下Jupyter(即IPython-notebook)的搭建及使用
- Flask学习总结笔记(1)-- 环境配置
- Nagios的启动与停止 查看初步配置情况
- 如何利用容器构建持续交付/持续发布系统? (有彩蛋)
- 常用滤波算法
- 栈及其应用
- MacOs + Virtualenv + ipython notebook下使用matplotlib
- Android逆向之旅---SO(ELF)文件格式详解
- javascript总结
- MySQL与MariaDB功能对比 --- NULL在ALL/SOME中的处理的不同
- 【51nod1105】【第K大的数】【二分答案】
- windows核心编程-线程的亲缘性
- VIEW
- Postgresql将查询结果导出到文件中
- Git常用命令