在virtualenv环境下使用matplotlib绘图时遇到了这样的问题:

>>> import matplotlib.pyplot as plt

Traceback (most recent call last):

File "", line 1, in

...

in

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 Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ

似乎是因为虚拟环境与默认环境的安装配置不同造成的。

搜索错误信息之后,在STO上找到了解决方案:

1、pip安装matplotlib之后,会在根目录下产生一个.matplotlib的目录:

➜ bin ll ~/.matplotlib

total 280

-rw-r--r-- 1 me staff 78K 10 4 2015 fontList.cache

-rw-r--r-- 1 me staff 59K 1 17 15:56 fontList.py3k.cache

drwxr-xr-x 2 me staff 68B 10 4 2015 tex.cache

2、在这个目录下创建一个名为matplotlibrc的文件,内容是:

backend: TkAgg

然后保存退出,重启Python交互界面或重新运行脚本,import正常执行。

STO答案地址:http://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python

runtime error python怎么解决_RuntimeError: Python is not installed as a framework 错误解决方案...相关推荐

  1. RuntimeError: Python is not installed as a framework 错误解决方案

    RuntimeError: Python is not installed as a framework 错误解决方案 参考文章: (1)RuntimeError: Python is not ins ...

  2. Microsoft Visual C++ Runtime Library Runtime Error的一个解决方法

    今天打开电脑,打开软件时出现了如下情况: 软件打不开并且会出现Runtime error错误,遂在网上寻找解决方法,都试了试但是并未解决问题. 想了想,这个问题出现的原因应该是VC++的运行库出现了问 ...

  3. Runtime Error(ACCESS_VIOLATION)常见解决方法

    Runtime Error(ACCESS_VIOLATION)即运行时访问了非法内存导致异常. 在我看来,主要有以下三种情况会导致这种错误: 数组开的不够大,假如题目的数据范围是1e6,而我们如果只开 ...

  4. 【linux】解决设置CentOS7虚拟机使用静态IP的常见错误解决方案

    最近在VMware虚拟机里玩Centos,装好后发现上不了网.经过一番艰辛的折腾,终于找到出解决问题的方法了.最终的效果是无论是ping内网IP还是ping外网ip,都能正常ping通.方法四步走: ...

  5. Micosoft Visual C++ Runtime Library Runtime Error! Program: E:\UserschenliqunAnaconda3\python.exe

    pycharm跑项目出现Microsoft Visual C++ Runtime Library Runtime Error! Program: E:\Users\Anaconda3\python.e ...

  6. c++ 调用 python脚本, runtime error r6034

    c++ 调用 python脚本, runtime error r6034 vs2015,c++调用python 脚本,PyImport_ImportModule的时候报了个run time error ...

  7. 运行出错 runtime error

    在网上查找和总结后记录了下面的解决方法. runtime error (运行时错误)就是程序运行到一半,程序就崩溃了. 比如说: ①除以零②数组越界:int a[3]; a[10000000]=10; ...

  8. VJ runtime error可能的原因

    自己刚开始在virtual judge上做题的时候,时不时会遇到runtime error的情况,因为不了解在线评测系统的报错方法,调试废了不少时间.在网上查找和总结后记录了下面的解决方法. runt ...

  9. 【Python】解决urllib返回http error 503问题

    [Python]解决urllib返回http error 503问题:https://www.cnblogs.com/tiandsp/p/13783038.html

最新文章

  1. STM32CubeMX简介、下载及安装(NB-IoT专栏—基础篇3)
  2. 解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题
  3. 在CentOS上禁用IPv6
  4. vb链接mysql登录界面_求大神!有谁会用VB设计用户登陆界面连接到数据库
  5. kubeadm单集群部署k8s1.15.1flannel网络
  6. 华为手机记事本导出_涨知识!原来华为手机自带的录音转文字这么好用,秒变会议神器...
  7. linux中timer的作用,linux - linux / timer.h setup_timer()到期功能不起作用? - 堆栈内存溢出...
  8. @encode(type)的使用
  9. 网络协议:关于TCP/IP,必须知道的十个知识点
  10. 7. memcache 细节
  11. WORD文件拼版生成PDF方法
  12. php添加ico,PHP生成ICO图标的代码
  13. GET请求淘宝H5页面获取商品信息
  14. 今天来聊聊CAD的“外挂”
  15. postman全方位讲解(有空看下)
  16. win7 mysql 应用程序无法启动因为应用程序的并行配置不正确
  17. matlab中plot函数画线时 颜色和类型
  18. 在discuz论坛增加背景音乐代码
  19. 面试遇见简单算法总结
  20. 时针分针角度问题(不含秒针)

热门文章

  1. 北斗系统海拔高度测试软件,GPS海拔测量仪手机版
  2. 【专利转让】掌纹识别、图像复原、人脸检测定位相关领域
  3. 录屏存储为gif图片
  4. design/sourcecode/课堂笔记designPrinciples
  5. 解锁黑科技!辅助驾驶系统为卡车安全行驶保驾护航
  6. 减半技术实现求a的n次幂
  7. 寻仙服务器维护到几点,寻仙10月14日上午服务器例行维护公告
  8. 2017年中国软件业务收入报告新鲜出炉,华为以2178亿元连续16年蝉联榜首
  9. 瑞星:病毒伪装“交行安全控件”盗取用户敏感信息
  10. OpenCV OAK-D-S2相机测试