LoginSignup
93
46

More than 5 years have passed since last update.

Pythonでmatplotlibをimportするとエラーが出る場合の対処策(Mac)

Last updated at Posted at 2017-07-05

エラー内容:

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.

バックエンドの問題が発生しているようなので書き換えに行きます。

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

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

みたいに場所が特定できますのでFinderで移動。

matplotlibrc というファイルがあるのでテキストエディタで開き、

backend : macosx

と記述してある箇所を特定できたら以下のように書き換えて完了。

backend : Tkagg
93
46
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
93
46