问题描述
我是Python的新手,想使用其plot
功能创建图形.我正在使用ubuntu 12.04.我从 http:/遵循了Python安装步骤/eli.thegreenplace.net/2011/10/10/installing-python-2-7-on-ubuntu/,但是当我这样做
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 *
我收到此错误
>>> from pylab import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pylab
我的Python版本是python 2.7
.有人可以告诉我我在这里想念什么吗?
My Python version is python 2.7
. Can anybody tell me what I am missing here?
推荐答案
您需要安装numpy,scipy和matplotlib才能获得pylab.在ubuntu中,您可以使用以下命令安装它们:
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
如果您从源代码安装了python,则需要通过pip安装这些软件包.请注意,您可能必须安装其他依赖项才能执行此操作,还需要在其他两个依赖项之前安装numpy.
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.
也就是说,我建议在存储库中使用python版本,因为我认为它是最新版本的python(2.7.3).
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).
这篇关于python错误:没有名为pylab的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!