What to do if you get an error when importing matplotlib in Python (Mac)

error contents:

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 using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

There seems to be a backend problem, so I'm going to rewrite it.

$ python -c "import matplotlib;print(matplotlib.matplotlib_fname())"

/anaconda/envs/py3.5/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc

Since you can specify the location like this, move it with Finder.

There is a file called matplotlibrc, so open it with a text editor and open it.

backend : macosx

If you can identify the part where it is described, rewrite it as follows and complete.

backend : Tkagg

Recommended Posts

What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get an error when installing python with pyenv
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get an error when running "certbot renew" in CakePHP environment
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you run python in IntelliJ and end with an error
What to do if you get a minus zero in Python
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if an error occurs when importing numpy with VScode
When you get an error in python scraping (requests)
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get a must override `get_config` error when trying to model.save in Keras
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What to do if you get a "No versions found" error in pipenv
[python] What to do when an error occurs in send_keys of headless chrome
What to do if you get "Python not configured." Using PyDev in Eclipse
[Python] What to check when you get a Unicode Decode Error in Django
What to do if you get "coverage unknown" in Coveralls
What to do if you get an error like'Qstring' has already been set to version 1 using mne python
What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
What to do if you get an "unknown service" error from your gRPC server
What to do if you get `No kernel for language python found` in Hydrogen
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if the print command itself causes an error in Maya python
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do when you get an error saying "Name resolution temporarily failed" on linux
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do to get google spreadsheet in python
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if you couldn't send an email to Yahoo with Python.
What to do if you can't use scikit grid search in Python
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
[Python] What to do when an error related to SSL authentication is returned
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
What to do when you can't bind CaboCha to Python
Workaround if you get an error when trying to install PySide with pip
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
What to do if you get a Permission denied (public key) error when trying to pull on Github
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
An app that you must put in Linux
What to do if you get an error when importing matplotlib in Python (Mac)
When you get an error in python scraping (requests)
What to do if you get an error when running "certbot renew" in CakePHP environment
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do when an error occurs with import _ssl
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
What to do if Sort imports get stuck in VS Code's Python Extension (around 2020/09)
What to do if `pip install matplotlib` fails on Mac
What to do if you can't log in as root
What to do if an error occurs when loading a python project created with poetry into VS Code