在Ubuntu上安装SciPy

我有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. 

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

 apt-get install blas apt-get install atlas 

但是,easy_install错误不会消失。

谢谢!

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

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

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

 sudo apt-get install python-numpy python-scipy 

什么对我有效:

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

一旦安装了这些软件包,scipy安装程序应按预期完成。

sudo apt-get install python-scipy在我的情况下工作。

如果您使用Python3,则可以使用apt-get来安装软件包

 sudo apt-get install python3-numpy python3-scipy 

如果你还想用pip来安装,你可以使用build-dep来获得python-numpy和python-scipy的依赖关系,然后用pip

 sudo apt-get build-dep python-numpy python-scipy 

替代python3作为其他答案的状态,这就是你在找什么。

我通过运行解决了这个问题(类似于以前的建议)

 apt-get install scipy 

我解决了这个问题,运行:

 sudo pip install scipy