Reputation: 299
I am trying to run this program
import matplotlib.pyplot as plt
import numpy
plt.plot([1, 2, 3],[5, 7, 4])
plt.show()
I am getting an error message: ImportError: No module named pyplot
I have installed matplotlib on Windows 8 64-bit, Python 2.7 with pip command from bash and I also updated it, got this message as a result:
Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install --upgrade matplotlib
Requirement already up-to-date: matplotlib in c:\python27\lib\site-packages
Requirement already up-to-date: pyparsing>=1.5.6 in c:\python27\lib\site-packages\pyparsing-2.0.3-py2.7-win32.egg (from matplotlib)
Requirement already up-to-date: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already up-to-date: pytz in c:\python27\lib\site-packages\pytz-2015.6-py2.7.egg (from matplotlib)
Requirement already up-to-date: python-dateutil in c:\python27\lib\site-packages\python_dateutil-2.4.2-py2.7.egg (from matplotlib)
Requirement already up-to-date: six>=1.4 in c:\python27\lib\site-packages\six-1.10.0-py2.7.egg (from matplotlib)
When I tried to install pyplot I got this massage:
Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install pyplot
Collecting pyplot
Could not find a version that satisfies the requirement pyplot (from versions: )
No matching distribution found for pyplot
If anyone has an idea how to install pyplot and why my distribution is not matching, I appreciate your help.
Upvotes: 15
Views: 110502
Reputation: 101
If you try
pip install matplotlib
and it fails, try
pip install --upgrade matplotlib
You might already have the package pre-installed.
Upvotes: 10
Reputation: 146
Or what you can do is just try
pip install matplotlib
.
Then import matplotlib.pyplot to make get the pyplot data. matplotlib is a module with pyplot inside it so you can access pyplot easily.
Upvotes: 9
Reputation: 585
Try reinstalling matplotlib from here. It doesn't matter if you're on a 64 bit computer (I am as well). What matters is which version of Python did you install? If you installed the 32-bit (recommended as it's somewhat easier to deal with), then you still install the 32-bit versions of modules.
The site I linked you shows prerequisite modules for matplotlib, so make sure you also have those installed.
Upvotes: 9