前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Mac使用 matplotlib 画图 => RuntimeError: Python is not installed as a framework

Mac使用 matplotlib 画图 => RuntimeError: Python is not installed as a framework

作者头像
片刻
发布2019-05-28 23:42:33
8760
发布2019-05-28 23:42:33
举报
文章被收录于专栏:AILearningAILearning

Mac使用 matplotlib 画图

遇到问题:

代码语言:javascript
复制
Traceback (most recent call last):
  File "/opt/git/scikit-learn-doc-zh/flowchart/src/quickstart/test_matplotlib.py", line 11, in <module>
    import matplotlib.pyplot as plt
  File "/Users/jiangzl/.virtualenvs/python3/lib/python3.5/site-packages/matplotlib/pyplot.py", line 113, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/jiangzl/.virtualenvs/python3/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 60, in pylab_setup
    [backend_name], 0)
  File "/Users/jiangzl/.virtualenvs/python3/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py", line 19, in <module>
    from matplotlib.backends import _macosx
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.

解决方案:

代码语言:javascript
复制
vim ~/.matplotlib/matplotlibrc 

然后输入以下内容:

代码语言:javascript
复制
backend: TkAgg

转载地址: http://blog.csdn.net/patrick75/article/details/50885025

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017年11月15日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档