importorror:没有名为scipy的模块

2024-04-18 13:37:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用Python2.7并试图让PyBrain工作。

但即使安装了scipy,我也会得到这个错误-

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-
py2.7.egg/pybrain/__init__.py", line 1, in <module>
    from pybrain.structure.__init__ import *
  File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/__init__.py", line 1, in <module>
    from pybrain.structure.connections.__init__ import *
  File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/connections/__init__.py", line 1, in <module>
    from pybrain.structure.connections.full import FullConnection
  File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/connections/full.py", line 3, in <module>
    from scipy import reshape, dot, outer
ImportError: No module named scipy

我已经用这个命令安装了scipy-

sudo apt-get install python-scipy

我得到-

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

我该怎么办?


Tags: ininitegglibpackagesusrlocalline
3条回答

尝试使用pip将其安装为python包。你说你已经试过了:

sudo apt-get install python-scipy

现在运行:

pip install scipy

我运行了这两个程序,它在我的基于Debian的盒子上运行。

为了确保python的安装简单而正确,可以从一开始就使用pip

要安装pip:

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2 get-pip.py   # for python 2.7
$ sudo python3 get-pip.py   # for python 3.x

要使用pip安装scipy:

$ pip2 install scipy    # for python 2.7
$ pip3 install scipy    # for python 3.x

对于windows用户:

几天后我找到了这个解决方案。首先要安装哪个python版本?

如果您想要Python2.7版本:

步骤1:

scipy‑0.19.0‑cp27‑cp27m‑win32.whl

scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl

numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl

numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl

如果您需要Python3.4版本:

scipy‑0.19.0‑cp34‑cp34m‑win32.whl

scipy‑0.19.0‑cp34‑cp34m‑win_amd64.whl

numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl

numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl

如果您想要Python3.5版本:

scipy‑0.19.0‑cp35‑cp35m‑win32.whl

scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl

numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl

numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl

如果您需要Python3.6版本:

scipy‑0.19.0‑cp36‑cp36m‑win32.whl

scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl

numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl

numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl

链接:[单击[1]

安装完成后,转到目录。

例如我的目录:

cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]

步骤2:

Numpy+MKL

再次从基于python版本的同一网站:

之后,在脚本文件夹中再次使用相同的内容

cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]

并在python文件夹中测试它。

Python35>python 
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. 
>>>import scipy

相关问题 更多 >