There was a problem using the Python matplotlib library on Mac OS X:
>>> import NumPy as NP >>> import Matplotlib.pyplot as Plt Traceback (most recent call last): File "&L T;stdin> ", line 1, in <module> File"/users/david/anaconda2/envs/tensorflow/lib/python3.6/site-packages/ matplotlib/pyplot.py ", line 113, in <module> _backend_mod, New_figure_manager, draw_if_interactive, _show = Pyla B_setup () File "/users/david/anaconda2/envs/tensorflow/lib/python3.6/site-packages/matplotlib/backends/__init__. Py ", line, in Pylab_setup [Backend_name], 0) File"/users/david/anaconda2/envs/tensorflow/lib/python3.6/site-pack ages/matplotlib/backends/backend_macosx.py ", line, in <module> matplotlib.backends import _macosx Runtim Eerror:python is not installed as a framework. The Mac OS X backend won't be able to function correctly if Python isn't installed as a framework. The information on installing Python as a framework on MAC OS X is the Python documentation for the. Please either reinstall Python as A framework, or try one of the other backends. If you are are using (Ana) Conda Please install Python.app and replace the "Python" with ' pythonw '. The ' Working with matplotlib on OS X ' matplotlib FAQ for more information.
2 methods are introduced on the network, which can be tested.
Method One:
Add the following two lines of code to resolve:
>>> import matplotlib
>>> matplotlib.use (' Tkagg ')
# #在import Matplotlib under the module, such as Pyplot before adding the above 2 sentences
>>> import Matplotlib.pyplot as Plt
Method Two:
It's awkward to write in every Python script file.
Add the Matplotlib configuration:
echo "Backend:tkagg" >> ~/.MATPLOTLIB/MATPLOTLIBRC