RuntimeError: Python is not installed as a framework

问题描述

引入 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

解决方法

进入目录: ~/.matplotlib

创建一个名为matplotlibrc的文件,内容是:

backend: TkAgg

参考:

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

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页