파이썬에서 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
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 24, in <module>
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
This solution worked for me. If you already installed matplotlib using pip on your virtual environment, you can just type the following:
$ cd ~/.matplotlib
$ nano matplotlibrc
And then, write backend: TkAgg in there. If you need more information, just go to the solution link
[참고]
http://stackoverflow.com/questions/29433824/unable-to-import-matplotlib-pyplot-as-plt-in-virtualenv
'Programming > Python' 카테고리의 다른 글
[Python] Flask logging 하는 방법 (0) | 2017.02.07 |
---|---|
[Python] Virtualenv 설치 및 dependencies 관리하기 (0) | 2017.02.07 |
[Python] stdin, stdout, pipeline 이용해 데이터 처리하는 방법 (0) | 2017.02.07 |
파이썬으로 HTML 파싱하기 (0) | 2017.02.07 |
[데이터과학] 데이터 수집하는 방법 (예제: 오라일리의 데이터 관련 책) - 페이지 스크랩, 정책 (0) | 2017.02.07 |