Python error: no module named pylab

I am new to Python and want to use its plot functionality to create graphs. I am using ubuntu 12.04. I followed the steps to install Python from http://eli.thegreenplace.net/2011/10/10/installing-python-2-7-on-ubuntu/ , but when I do

 from pylab import * 

I get this error

 >>> from pylab import * Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pylab 

My version of Python is python 2.7 . Can someone tell me what I am missing here?

+65
python matplotlib
Jun 09 '12 at 23:30
source share
5 answers

You will need to install numpy, scipy and matplotlib to get pylab. In ubuntu, you can install them with this command:

 sudo apt-get install python-numpy python-scipy python-matplotlib 

If you installed python from the source, you will need to install these packages through pip. Note that you may need to install other dependencies for this, as well as install numpy in front of the other two.

However, I would recommend using the python version in the repositories, as I think it is relevant with the current python version (2.7.3).

+105
Jun 09 2018-12-12T00:
source share

I solved the same problem by installing "matplotlib".

+31
Nov 07 '12 at 18:12
source share

I installed python-numpy python-scipy python-matplotlib but this did not work for me and I got the same error. Pylab is not recognized without matplotlib. So I used this:

 from matplotlib import pylab from pylab import * 

and worked for me.

+5
May 15 '16 at 5:47
source share

An error means that pylab is not part of the standard Python libraries. You will need to download it and install. I think it is available here . They have installation instructions here.

+3
Jun 09 '12 at 23:35
source share

What you did following these instructions created a completely new Python installation, separate from the Python system that Ubuntu packages run.

The modules that you installed on the Python system (for example, installed through packages or manually using the Python system to start the installation process) will not be available, since your /usr/local -based python configured to be viewed in your own module directories, not in the python system.

Now you can re-add the missing modules by creating them and installing them with the new

based on /usr/local .

+3
Jun 09 '12 at 23:38
source share



All Articles