Skip to content

SciPy

SciPy (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering.

Features

  • scipy.integrate: 수치적분 루틴과 미분방정식 해법기
  • scipy.linalg: numpy.linalg에서 제공하는 것보다 더 확장된 선형대수 루틴과 매트릭스 분해
  • scipy.optimize: 함수 최적화기와 방정식의 근을 구하는 알고리즘
  • scipy.signal: 시그널 프로세싱 도구
  • scipy.sparse: 희소 행렬과 희소 선형 시스템 풀이법
  • scipy.special: 감마 함수처럼 흔히 사용되는 수학 함수를 구현한 포트란 라이브러리인 SPECFUN 확장
  • scipy.stats: 표준 연속/이산 확률 분포(집적도 함수, 샘플러, 연속 분포 함수)와 다양한 통계 테스트, 그리고 좀 더 기술적인 통계 도구
  • scipy.weave: 배열 계산을 빠르게 하기 위해 인라인 C++ 코드를 사용하는 도구

How to install

This worked for me on Ubuntu 14.04:

$ sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran
$ pip install scipy

Troubleshooting

No Fortran compiler found

pip를 사용하여 컴파일 하는 도중 아래와 같은 에러가 발생할 수 있다.

building 'dfftpack' library

error: library dfftpack has Fortran sources but no Fortran compiler found

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e7EQsj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/scipy
Storing debug log for failure in /root/.pip/pip.log

이 경우 Fortran을 설치하면 된다.

$ sudo apt-get install gfortran

scipy.misc module has no attribute imread?

Error log:

>>> import scipy
>>> scipy.misc
<module 'scipy.misc' from 'C:\Python27\lib\site-packages\scipy\misc\__init__.pyc'>
>>> scipy.misc.imread('test.tif')
Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    scipy.misc.imread('test.tif')
AttributeError: 'module' object has no attribute 'imread'

imread is depreciated after version 1.2.0! So to solve this issue I had to install version 1.1.0.

$ pip install scipy==1.1.0

See also

Favorite site