ImportError:没有名为scipy的模块

ihm*_*all 77 python scipy python-2.7 pybrain

我正在使用Python 2.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
Run Code Online (Sandbox Code Playgroud)

我用这个命令安装了scipy -

sudo apt-get install python-scipy
Run Code Online (Sandbox Code Playgroud)

我明白了 -

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.
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

Bos*_*rge 127

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

sudo apt-get install python-scipy
Run Code Online (Sandbox Code Playgroud)

现在运行:

pip install scipy
Run Code Online (Sandbox Code Playgroud)

我跑了两个,它在我的基于Debian的盒子上工作.

  • @DragonSpit如果你有python 3,那么你需要使用相应的名称:“python3-scipy”和“pip3”。 (6认同)

小智 16

为了确保方便和正确的安装python使用点开始

要安装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
Run Code Online (Sandbox Code Playgroud)

使用pip安装scipy:

$ pip2 install scipy    # for python 2.7
$ pip3 install scipy    # for python 3.x
Run Code Online (Sandbox Code Playgroud)


Kar*_*oki 7

我有同样的问题,因为我安装了 python2.7 和 python3。当我用 python3 运行程序时,我收到了同样的错误。我用这个命令安装了 scipy,问题已经解决:

sudo apt-get install python3-scipy
Run Code Online (Sandbox Code Playgroud)


Ogg*_*las 6

如果您需要进入scipyWindows 上的 Pyhton 环境,您可以在此处获取 *.whl 文件:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

请记住,您需要先安装,numpy+mkl然后才能安装scipy

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

下载正确的 *.whl 文件后,只需在下载目录中打开 cmd 提示符并运行pip install *.whl.


Bey*_*Gül 6

对于Windows用户:

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

如果你想要Python 2.7版本:

步骤1:

SciPy的-0.19.0-cp27-cp27m-win32.whl

SciPy的-0.19.0-cp27-cp27m-win_amd64.whl

numpy的-1.11.3 + MRL-cp27-cp27m-win32.whl

numpy的-1.11.3 + MRL-cp27-cp27m-win_amd64.whl

如果你想要Python 3.4版本:

SciPy的-0.19.0-CP34-cp34m-win32.whl

SciPy的-0.19.0-CP34-cp34m-win_amd64.whl

numpy的-1.11.3 + MRL-CP34-cp34m-win32.whl

numpy的-1.11.3 + MRL-CP34-cp34m-win_amd64.whl

如果你想要Python 3.5版本:

SciPy的-0.19.0-CP35-cp35m-win32.whl

SciPy的-0.19.0-CP35-cp35m-win_amd64.whl

numpy的-1.11.3 + MRL-CP35-cp35m-win32.whl

numpy的-1.11.3 + MRL-CP35-cp35m-win_amd64.whl

如果你想要Python 3.6版本:

SciPy的-0.19.0-CP36-cp36m-win32.whl

SciPy的-0.19.0-CP36-cp36m-win_amd64.whl

numpy的-1.11.3 + MRL-CP36-cp36m-win32.whl

numpy的-1.11.3 + MRL-CP36-cp36m-win_amd64.whl

链接:[点击[1]

完成安装后,转到您的目录.

例如我的目录:

cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]
Run Code Online (Sandbox Code Playgroud)

第2步:

NumPy的+ MKL

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

之后在Script文件夹中再次使用相同的东西

cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]
Run Code Online (Sandbox Code Playgroud)

并在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
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,它对我有用.为了省时间,我们可以在这里找到这些车轮http://www.silx.org/pub/wheelhouse/ :) (2认同)

Mah*_*hid 6

如果您使用的是 pycharm,请转到设置并在项目解释器子选项卡中单击列表旁边的“+”号,然后在搜索栏中搜索名称“scipy”并安装软件包。

scipy


小智 5

对于 Windows 用户:pip install -U scipy