frommatplotlib.backends import_macosx
RuntimeError: Python isnotinstalled asa framework. The Mac OS X backend will notbe able to function correctly ifPython isnotinstalled asa framework. See the Python documentation formore information on installing Python asa framework on Mac OS X. Please either reinstall Python asa framework, ortryone of the other backends. If you are using (Ana)Conda please install python.app andreplace the use of 'python'with'pythonw'. See 'Working with Matplotlib on OSX'inthe Matplotlib FAQ formore information.
解决方法:
把import matplotlib.pyplot as plt
改成下面的:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt