Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

エラー内容:

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
Gen6
メタルギタリスト。世界を縮める Growth Hacker.
https://www.gekite2.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした