欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

from matplotlib import某函数Error--RuntimeError: Python is not installed as a frame

程序员文章站 2022-07-07 23:40:46
from matplotlib import某函数Error--RuntimeError: Python is not installed as a framework问题解决 在mac上装...

from matplotlib import某函数Error--RuntimeError: Python is not installed as a framework问题解决

在mac上装一个tensorflow做一些小的实验还是蛮方便的。用virtualenv的方式避免了很多麻烦。

sudo pip install --upgrade virtualenv

virtualenv --system-site-packages tensorflow

pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-py2-none-any.whl

但是在运行的时候发现报错:

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

解决的方法也很简单:

vim ~/.matplotlib/matplotlibrc

然后输入以下内容:

backend: TkAgg