您的位置:首页 > 其它

ImportError: No module named pylab

2013-06-07 12:50 363 查看
I am new to Python and want to use its
plot
functionality to create graphs. I am using ubuntu 12.04. I followed the Python installation steps from
http://eli.thegreenplace.net/2011/10/10/installing-python-2-7-on-ubuntu/ but when I do

from pylab import *

I am getting this error

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

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

You'll 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 source you will need to install these packages through pip. Note that you may have to install other dependencies to do this, as well as install numpy before the other two.

That said, I would recommend using the version of python in the repositories as I think it is up to date with the current version of python (2.7.3).

share|improve
this answer
edited
Jun 9 '12 at 23:39

answered
Jun 9 '12 at 23:34




Trevor

2,899715

don't I need to connect what is installed in the system with the python that I already have? if I do as you told then it installs in the system. Can you please tell me how can I connect these two? – Sadiksha
Gautam Jun 9 '12 at
23:57
1
You will either have to uninstall the python you have and use the repository version, or use pip to install numpy, scipy and matplotlib. The command to do that is
pip install numpy
then
pip install scipy matplotlib
. – Trevor
Jun 10 '12 at 0:59
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: