ImportError:没有名为numpy的模块

use*_*467 5 python numpy

我正在尝试运行需要安装Numpy的程序。我以为是这样,因为如果尝试,sudo apt-get install python-numpy它会告诉我

sudo apt-get install python-numpy

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-numpy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)

但是当我尝试安装程序时(在该程序目录中,setup.py所在的位置),我得到:

python setup.py install
Traceback (most recent call last):
   File "setup.py", line 20, in <module>
    from weblogolib import __version__
  File "/home/chris/Documents/IS/Bioinformatics-Software/weblogo-3.3/weblogolib/__init__.py", line 108, in <module>
     from numpy import array, asarray, float64, ones, zeros, int32,all,any, shape
ImportError: No module named numpy
Run Code Online (Sandbox Code Playgroud)

当我在Python-2.7.3 / Lib / site-packages目录中查找时,唯一的内容是README文件。那里不应该有Numpy的东西(以及其他安装Python模块的东西)吗?

我正在使用Python 2.7运行Ubuntu 12.04

使用dpkg -l python-numpy我得到:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  python-numpy   1:1.6.1-6ubunt Numerical Python adds a fast array facility
Run Code Online (Sandbox Code Playgroud)

gpo*_*poo 4

您没有提及在哪里运行命令。对于命令,我猜您正在使用Ubuntu 12.10.

在 Ubuntu 12.10 中,默认值为 Python3(使用 进行检查python --version)。这样,当您运行 时python setup ...,您将使用可用的默认 python 来运行它。无论如何,weblog 3.3 需要 Python 2.5、2.6 或 2.7。

另外,您可以检查 python-numpy 的安装位置(使用 检查dpkg -L python-numpy)。

我突然想到的是:

$ python2.7 setup.py install
Run Code Online (Sandbox Code Playgroud)

如果您还没有安装 python2.7,您应该安装它(很可能 shell 会建议它)。