RuntimeError: Python is not installed as a framework 错误解决方案
在virtualenv环境下使用matplotlib绘图时遇到了这样的问题:
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
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 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
RuntimeError: Python is not installed as a framework 错误解决方案的更多相关文章
- RuntimeError: Python is not installed as a framework 错误解决办法
因为我是macbook,mac是自带的python 2.7,但是我开发需要使用到的是python3,所以先使用pip3 install matplotlib 然后在交互页面键入import matpl ...
- matplotlib使用时报错RuntimeError: Python is not installed as a framework(一)
笔者在第一次安装matplotlib后运行时出现报错. import matplotlib as mlb from matplotlib import pylab as pl x = [1,3,5,7 ...
- RuntimeError: Python is not installed as a framework.
RuntimeError: Python is not installed as a framework. 文章转载:https://www.cnblogs.com/harelion/p/563776 ...
- 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 infor
在virtualenv环境下使用matplotlib绘图时遇到了这样的问题: >>> import matplotlib.pyplot as pltTraceback (most r ...
- 出现ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly ....的解决方法
在terminal上运行gluoncv时遇到了一个报错问题. ImportError: Python is not installed as a framework. The Mac OS X bac ...
- pip install报错:RuntimeError: Python version >= 3.5 required
由于pip官方的不作为,现如今python2(以及某些低版本python3)配套的pip,已经没法正常的安装pypi包了. 例如需要用到的一套PyCaffe的代码,是基于Python2的,于是用min ...
- plugin python was not installed: Cannot download ''
problem: plugin python was not installed: Cannot download ''........ 1. the first method of resoluti ...
- python学习笔记系列----(六)错误和异常
python至少有2类不同的错误:语法错误(Syntax Errors)和异常(Exceptions). 8.1 语法错误 这个单词应该还是很有必要认识的,呵呵,语法错误,也叫解析错误,是我们最不愿意 ...
- Python运行Google App Engineer时出现的UnicodeDecodeError错误解决方案
#Python运行Google App Engineer时出现的UnicodeDecodeError错误解决方案 ##问题描述 使用Python2.7.x运行GAE时有时会报这个错误 ```py ...
随机推荐
- linux设置自动更换壁纸
#!/bin/bash let n=0 files=($HOME/wallpapers/*.jpg) count=${#files[@]} while [ 1 ] do let "n=n%$ ...
- CentOS乱码解决方法
linux 中文显示乱码解决办法, 其实是有多种情况的, 有一部分是由于终端默认的设置造成的 vi /etc/sysconfig/i18n 将内容改为LANG="zh_CN.GB18030& ...
- Android 接收系统广播(动态和静态)
1.标准广播:是一种完全异步执行的广播,在广播发出之后,所有的广播接收器几乎会在同一时刻接收到这条广播信息,它们之间没有先后顺序.效率高.无法被截断. 2.有序广播:是一种同步执行的广播,在广播发出后 ...
- jumpserver堡垒机web终端支持复制粘贴功能
公司最近内部搭建了一个jumpserver堡垒机,但是web终端连接Windows时候没法复制粘贴文字文本 然后找了一下jumpserver官方说明没找到相应的说明,但是知道是guacamole这个组 ...
- 皮肤控件IrisSkin4.dll调用样例-vs2010-c#
http://blog.csdn.net/wy7980/article/details/41933095
- 基于C#的单元测试(VS2015)
这次来联系怎么用VS2015来进行C#代码的单元测试管理,首先,正好上次写了一个C#的WordCount程序,就用它来进行单元测试联系吧. 首先,根据VS2015的提示,仅支持在共有类或共有方法中支持 ...
- 寒假集训——搜索 D - Cubes for Masha
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h&g ...
- DP E - Cheapest Palindrome
Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate ...
- OPENSTACK在RHEL7安装;admin创建虚拟机模板供demo使用
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u010026901/article/details/30965601 首先RHEL7安装.导入镜像, ...
- nginx防攻击的简单配置
主要通过两方案来做防护,一是nginx自带模块限制请求连接数和并发数:二是筛选IP加入黑名单: 1.并发数和连接数控制的配置 nginx http配置: #请求数量控制,每秒20个 ...