I'm trying to learn how to use matplotlib to start replacing Matlab in my life, but I'm having trouble getting started. I added python and pip to my path so i could pip install matplotlib from my command prompt, and I see it's installed in my python\lib\site-packages file, but when I type in "import matplotlib.pyplot as plt" to get started and run the rest of my simple plot code, pycharm says that there is no module named matplotlib. My plot code runs fine on the shell, copied and pasted from the same stuff I'm trying to run in pycharm however. What do I need to do to go this to run in pycharm as well?
2 Answers
Pycharm can select between many different python installations on your system, it sounds like you have selected a version different from the one in which you installed matplotlib. You probably installed matplotlib with pip. Check which pip you used by putting which pip if you're under *nix. then check which one Pycharm is using in your project.
pip3 install matplotlibto install matlplot lib. By default, pip will install those package for 2.7 as it the native one. For python 3 you'll have to install it.