在Ubuntu上安装SciPy

Jac*_*son 25 python ubuntu

我运行Python 2.7并尝试使用easy_install安装scipy,它返回以下错误:

Searching for scipy
Reading http://pypi.python.org/simple/scipy/
Reading http://www.scipy.org
Reading http://sourceforge.net/project/showfiles.php?group_id=27747&package_id=19531
Reading http://new.scipy.org/Wiki/Download
Best match: scipy 0.11.0
Downloading http://pypi.python.org/packages/source/s/scipy/scipy-0.11.0.zip#md5=40b700ddde9ddab643b640fff7a9d753
Processing scipy-0.11.0.zip
Running scipy-0.11.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-49BQSz/scipy-0.11.0/egg-dist-tmp-KMjwKy
Running from scipy source directory.
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1425: UserWarning: 
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1434: UserWarning: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  warnings.warn(BlasNotFoundError.__doc__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1437: UserWarning: 
    Blas (http://www.netlib.org/blas/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [blas_src]) or by setting
    the BLAS_SRC environment variable.
  warnings.warn(BlasSrcNotFoundError.__doc__)
error: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
Run Code Online (Sandbox Code Playgroud)

所以我通过执行安装了Blas和Atalas

apt-get install blas
apt-get install atlas
Run Code Online (Sandbox Code Playgroud)

但是,easy_install错误不会消失.

谢谢!

Car*_*rot 71

什么对我有用:

要从PIP实际安装scipy,您需要包libatlas-base-dev(ATLAS/BLAS的库等)和gfortran(GNU Fortran编译器).

安装这些软件包后,scipy安装程序应按预期完成.

  • 这才是真正的答案.谢谢 (7认同)

flu*_*lup 30

Ubuntu将库文件放在一个相当奇特的目录中. /usr/lib/x86_64-linux-gnu/什么的,取决于你的架构.您需要将此目录添加到site.cfg文件或BLAS环境变量中.

如果简易安装也需要头文件,则需要安装相应的-dev软件包.

但是,就像@ pitsanu-swangpheaw建议的那样,您也可以使用ubuntu包管理器安装到站点包目录.

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


AMI*_*NGH 5

sudo apt-get install python-scipy在我的案例中起作用。


Chi*_*and 5

如果您使用的是Python3,则可以使用安装包 apt-get

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