티스토리 뷰

맥에서 Python 개발을 할 때, matplotlib 로 그래프 출력이 안되는 경우가 있는 것 같다.


에러 메시지는 다음과 같이 난다.


    import matplotlib.pyplot as plt

  File "/Users/cosrah/anaconda3/envs/py35/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>

    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "/Users/cosrah/anaconda3/envs/py35/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup

    [backend_name], 0)

  File "/Users/cosrah/anaconda3/envs/py35/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py", line 17, 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. 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.


이 경우에 다른 방법을 좀 써봤지만, Stack overflow에 올라온 글이 도움이 되었다.



import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt



사용할 수 있는 방식은 여러가지지만, 그 중에 별탈없이 잘 나오는 TkAgg -- Good!!


['WXAgg', 'MacOSX', 'WX', 'GTK', 'WebAgg', 'Qt5Cairo', 'Qt4Agg', 'gdk', 'TkAgg', 'nbAgg',

'GTKAgg', 'GTK3Agg', 'svg', 'WXCairo', 'template', 'GTKCairo', 'pdf', 'Qt4Cairo', 'agg',

'GTK3Cairo', 'pgf', 'TkCairo', 'Qt5Agg', 'cairo', 'ps']


아래는 출력 화면을 넣으려고 했으나;; 티스토리에 사진을 못붙여 넣겠네.. 맥북 구리다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함