Students trying to import the package “matplotlib” on PyCharm will soon face the cryptic error message: “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.”
It is extremely puzzling what to do. I have researched the steps that you can follow to solve it in 3 minutes:
First you need to install the “matplotlib” on PyCharm following the instructions here: https://stackoverflow.com/questions/21883768/pycharm-and-external-libraries
Then, to import matplotlib, you need the following lines:
import matplotlib as mpl mpl.use('TkAgg') import matplotlib.pyplot as plt
Done! You are ready to use matplotlib on PyCharm interpreter, by using:
plt.plot(...) plt.show()
One thought on “import matplotlib on PyCharm: Quick 3 min solution”