Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ImportError:没有名为scipy的模块_Python_Python 2.7_Scipy_Pybrain - Fatal编程技术网

Python ImportError:没有名为scipy的模块

Python ImportError:没有名为scipy的模块,python,python-2.7,scipy,pybrain,Python,Python 2.7,Scipy,Pybrain,我正在使用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 <modul

我正在使用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
我得到-

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.

我该怎么办?

您的python不知道您在哪里安装了scipy。将scipy路径添加到
PYTHONPATH
,我希望它能解决您的问题。

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

sudo apt-get install python-scipy
现在运行:

pip install scipy

我运行了这两个程序,它在我基于Debian的机器上运行

我建议您通过

apt-get purge scipy
然后安装它

pip install scipy

如果您同时执行这两种操作,则可能会由于版本不同而混淆deb package manager。

要确保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上的Pyton环境中获取
scipy
,您可以在此处获取*.whl文件:

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

下载正确的*.whl文件后,只需在下载目录中打开一个cmd提示符,然后为windows用户运行
pip install*.whl

几天后我找到了这个解决方案。首先,要安装哪个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+mkl‑cp27‑cp27m‑win32.whl

numpy-1.11.3+mkl-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+mkl‑cp34‑cp34m‑win32.whl

numpy-1.11.3+mkl-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+mkl‑cp35‑cp35m‑win32.whl

numpy-1.11.3+mkl-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+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

尝试使用pip将其安装为python包,如下所示

$ sudo apt-get install python-scipy
如果要运行python 3.x脚本,请通过以下方式安装scipy:

$ pip3 install scipy
Otherwise install it by:
$ pip install scipy

我的问题是,在使用pip3安装时,我将其中一个库拼写错误,导致同一命令中所有其他下载的库都未安装。只需再次在它们上运行pip3 install,就可以从缓存中安装它们。

对于Windows用户:
pip install-U scipy

我遇到了相同的问题,因为我同时安装了python2.7和python3。当我使用python3运行程序时,我收到了相同的错误。 我使用此命令安装scipy,问题已解决:

sudo apt-get install python3-scipy

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

这可能太基本了(也许是可以理解的),但是-

Fedora用户可以使用:

sudodnf安装pythonscipy

然后(对于python3.x):

pip3安装scipy

或(对于python2.7):


pip2 install scipy

使用
sudo pip install scipy
安装库,这样它以后就不能请求权限了

python-c'import scipy;print(scipy)
哪条python
python-c'import sys;print(sys.path)回溯(最近一次调用):文件“”,importorror中的第1行:没有一个名为scipy的模块及其python 2.7.5没有sudo的解决方案吗?嗨。非常感谢,但是你能给我一个这样做的命令吗?Linux新手,如果你正在使用bash,在你的bash配置文件中,你可以添加这一行
export PYTHONPATH=“/path/to/scipy:$PYTHONPATH”
我不能sudo…还有其他解决方案吗?我不明白问题出在哪里,为什么解决了问题?@DragonSpit如果你有python 3,那么你需要使用相应的名称:
python3 scipy
pip3
。谢谢,它对我有效。为了节省时间,我们可以在这里找到这些轮子:)
sudo apt-get install python3-scipy