Python/matplotlibをimportする時に「RuntimeError: Python is not installed as a framework」と出るときの解決法

Macでmatplotlibをimportしようとすると以下のようなエラーが出ることがある.

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.

バックエンドに問題があるため,matplotlibrcを編集.

backend : macosx

となっているところ

backend : Tkagg

としたところ無事に解決した.

参考