r/learnpython • u/Striking-Village3154 • 27m ago
Can't run matplotlib
I'm trying to make a graph using data points using matplotlib but for some reason, it's not working. I installed it using python -m pip install matplotlib and got a whole block of text with all the lines starting with, Requirement already satisfied. But, when I try to run, import matplotlib.pyplot as plt in my code, I get an error saying ModuleNotFoundError: No module named 'matplotlib'
Anyone know what the issue is and how I can get it resolved?
•
•
u/Necessary-Flounder52 21m ago
Are you running the code in the same environment in which you installed it, ie. the command line?
•
u/ResidentPomegranate6 12m ago
compare python -m pip -V against python -c "import sys;print(sys.executable)". the pip on your path is usually a different interpreter than the one running your file, which is how satisfied-yet-modulenotfound happens.
•
u/ee_control_z 11m ago
Do you have multiple versions of Python installed on your computer? It could be that you downloaded the module to another version of Python and the interpreter is linked to that version. To verify which modules you have installed you can type in the Python prompt:
help('modules')
To verify which Python versions you have installed on your computer, type the following in the command (CMD) prompt:
py -0
•
u/Ender_Locke 21m ago
are you installing globally but using a venv to run your python(or vice versa)