2019 六月 19 , 星期三
Home / 开发语言 / python / MAC matplotlib 错误 RuntimeError: Python is not installed as a framework.

MAC matplotlib 错误 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

转自 http://blog.csdn.net/patrick75/article/details/50885025

Check Also

python 解决 InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information

因为SSL的问题,urllib ...

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>