Mac系统上import matplotlib.pyplot as plt出现下面问题 ImportError: Python is not installed as a framework.

1.问题描述

mac系统上import matplotlib.pyplot as plt报如下错误

ImportError: 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. 

2.解决方法

cd ~/.matplotlib

vim matplotlibrc

输入backend: TkAgg 保存退出

重新运行脚本正确运行

你可能感兴趣的:(python)