I installed Python 3.7 on macOS 10.14 using Miniconda from here. My workflow uses iPython to run scripts that generate plots with Matplotlib. In my iPython configuration file ipython_config.py
, I have the following settings to properly render figure windows on the Mac:
c.InteractiveShellApp.gui = 'osx'
c.InteractiveShellApp.matplotlib = 'osx'
When I run iPython in the terminal, the following error appears:
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. 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.
I did not receive this error when using Matplotlib 2.2.3.
The Matplotlib 3.0 documentation states that a framework build of Python (referred to as pythonw
) is needed when using Conda and Matplotlib. I installed this with conda install python.app
. The documentation then says to use pythonw
instead of python
. But how do I tell iPython to use pythonw
?
Typing
echo "backend: TkAgg" > ~/.matplotlib/matplotlibrc
in a terminal fixed IPython for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With