import matplotlib.pyplot as plt
报错:
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.
解决方法:
- 用pip安装matplotlib后,会存在目录: ~/.matplotlib
- 直接在命令终端输入:~/.matplotlib/matplotlibrc
- 并在该目录下新建一个文件并添加内容:backend: TkAgg
- 保存即可
本文介绍了一种解决在MacOSX环境下安装matplotlib遇到的运行时错误的方法。通过配置matplotlibrc文件,指定使用TkAgg后端来规避Python未作为框架安装导致的问题。
873

被折叠的 条评论
为什么被折叠?



