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.
matplotlib. pyplot is a collection of command style functions that make matplotlib work like MATLAB. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc. In matplotlib.
matplotlib.pyplot.clf() Function. The clf() function in pyplot module of matplotlib library is used to clear the current figure.
MatPlotLib with Python PyLab is a procedural interface to the Matplotlib object-oriented plotting library. Matplotlib is the whole package; matplotlib. pyplot is a module in Matplotlib; and PyLab is a module that gets installed alongside Matplotlib. PyLab is a convenience module that bulk imports matplotlib.
The error "Could not find a version that satisfies the requirement" is often caused when you try to install a package using an older version of pip than is required. To solve the error, upgrade your version of pip .
If you try
pip install matplotlib
and it fails, try
pip install --upgrade matplotlib
You might already have the package pre-installed.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With