from matplotlib import pyplot 오류 처리

2127 단어 L_Python
Mac의 두 번째 Python 환경에 matplotlib을 설치한 후 다음 코드를 테스트합니다.
from matplotlib import pyplot   //    
pyplot.plot([1,2,3,4], [1,4,9,16])  //   
pyplot.show()       //    

그러나 첫 줄을 입력한 후 오류가 발생했습니다.
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 Working with Matplotlib in a virtual enviroment see ‘Working with Matplotlib in Virtual environments’ in the Matplotlib FAQ

해결 방법도 간단하다.
vim ~/.matplotlib/matplotlibrc 

그런 다음 다음을 입력합니다.
backend: TkAgg

좋은 웹페이지 즐겨찾기