Development Tip

ImportError : scipy라는 모듈이 없습니다.

yourdevel 2020. 10. 18. 19:40
반응형

ImportError : scipy라는 모듈이 없습니다.


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

이 명령을 사용하여 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.

어떻게해야합니까?


pip를 사용하여 Python 패키지로 설치하십시오. 이미 시도했다고 말했습니다.

sudo apt-get install python-scipy

이제 실행 :

pip install scipy

나는 둘 다 실행했고 내 데비안 기반 상자에서 작동했습니다.


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 버전은 무엇입니까?

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

다시 파이썬 버전을 기반으로 한 동일한 웹 사이트에서 :

그 후 Script 폴더에서 동일한 것을 다시 사용하십시오.

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

그리고 파이썬 폴더에서 테스트하십시오.

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

당신이 얻을해야하는 경우 scipyWindows에서 사용자의 Pyhton 환경에서 당신은 * .whl 파일을 여기에서 얻을 수 있습니다 :

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

Remember that you need to install numpy+mkl before you can install scipy.

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

When you have downloaded the correct *.whl files just open a cmd prompt in the download directory and run pip install *.whl.


I recommend you to remove scipy via

apt-get purge scipy

and then to install it by

pip install scipy

If you do both then you might confuse you deb package manager due to possibly differing versions.


Try to install it as a python package using pip as follows

$ sudo apt-get install python-scipy

If you want to run a python 3.x script, install scipy by:

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

For Windows User : pip install -U scipy


I had a same problem because I installed both of python2.7 and python3. when I run program with python3 I received same error. I install scipy with this command and problem has been solved:

sudo apt-get install python3-scipy

if you are using pycharm go to settings and in project interpreter sub-tab click on "+" sign next to list and in the search bar in there search name "scipy" and install the package.

scipy


Your python don't know where you installed scipy. add the scipy path to PYTHONPATH and I hope it will solve your problem.


My problem was that I spelt one of the libraries wrongly when installing with pip3, which ended up all the other downloaded libaries in the same command not being installed. Just run pip3 install on them again and they should be installed from their cache.


This may be too basic (and perhaps assumable), but -

Fedora users can use:

sudo dnf install python-scipy

and then (For python3.x):

pip3 install scipy

or (For python2.7):

pip2 install scipy

참고URL : https://stackoverflow.com/questions/24808043/importerror-no-module-named-scipy

반응형