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 ...
随机推荐
- LeetCode题解之 Find Mode in Binary Search Tree
1.题目描述 2.问题分析 使用map记录元素出现的次数. 3.代码 vector<int> v; map<int,int> m; vector<int> find ...
- LeetCode题解之Second Minimum Node In a Binary Tree
1.题目描述 2.问题分析 使用set. 3.代码 set<int> s; int findSecondMinimumValue(TreeNode* root) { dfs(root); ...
- SQL Server ->> DAC(Dedicated Administrator Connection)专用管理员连接
专用管理员连接是一种特殊的SQL Server服务器诊断性质的连接,用于在正常或者说标准连接形式无法连接SQL Server服务器的情况下连接到服务器进行服务器性能或者错误诊断.DAC同样支持安全加密 ...
- C#与Java AES 加密解密
参考文档:https://www.cnblogs.com/xbzhu/p/7064642.html 前几天对接Java接口,需要C#加密参数,Java解密.奈何网上找了一堆大同小异的加解密方法都跟Ja ...
- little kernel 小结
其实几篇文章都是摘自freebuf安全的文章: 高通(Qualcomm)LK源码深度分析 高通(Qualcomm)LK源码深度分析(二) 高通(Qualcomm)LK源码深度分析(三) 将其整理为比较 ...
- 免费ARP
1. 免费ARP基本概念 免费ARP,也叫Gratutious ARP.无故ARP.这种ARP不同于一般的ARP请求,它的Sender IP和Target IP字段是相同的,相当于是请求自己的IP地址 ...
- 安全之路 —— 无DLL文件实现远程线程注入
简介 在之前的章节中,笔者曾介绍过有关于远程线程注入的知识,将后门.dll文件注入explorer.exe中实现绕过防火墙反弹后门.但一个.exe文件总要在注入时捎上一个.dll文件着 ...
- win7计划任务报该任务映像己损坏或己篡改
目录 win7计划任务报该任务映像己损坏或己篡改 前言 解决方案 排查损坏的计划任务映像 win7计划任务报该任务映像己损坏或己篡改 文:铁乐与猫 2018-9-20 前言 win7下想自定义一些计划 ...
- 【PAT】B1044 火星数字(20 分)
/* 火星文有两位,第二位为0不输出 */ #include<stdio.h> #include<algorithm> #include<string.h> #in ...
- windows下编写shell脚本执行错误
在 windows 下,换行符是 \r\n,在linux下,换行符是 \n.如果你在IDEA里写sh脚本,可以手动设置脚本的换行符为 \n,如果你用notepad++写脚本,可以显示所有字符,以便明确 ...