Have found a similar issue, however haven\'t found proper solution.
Here\'s a code:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,2,5])
plt.sh
simply install:
python -m pip install -U pip
python -m pip install -U matplotlib
I had the same problem reasons in my case were
python 3.8.2 with matplotlib that I downloaded was for 3.7. Make sure they are the same.
python 64 bits version with matplotlib 32bits. Make sure they are the same
Use python -m pip install package_which_you_need
to install packages for Windows
Make sure to add to PATH the environment variables I forgot to do in my case
pip version was old use
Use python -m pip install --upgrade pip
to upgrade pip to the latest for Windows
I saved the file name as matplotlib.py. Try to avoid that
Finally I typed matplotlib.pyplot
as matplotlib.plyplot
remember to check for typos first. The error message looks similar even though I corrected all the steps above.
ModuleNotFoundError: No module named 'matplotlib.pyplot'
ModuleNotFoundError: No module named 'matplotlib.plyplot'
If you are using pycharm and have matplotlib.py in your current working directory than you get this error. Just delete or rename the matplotlib.py file and it will work.
don't name any file as matplotlib.py within your working directory
In your working directory, check if there is any file matplotlib.py Delete that file and import matplotib again. That should work.