在 centos 上安装 scipy 模块

Posted

技术标签:

【中文标题】在 centos 上安装 scipy 模块【英文标题】:install scipy module on centos 【发布时间】:2014-09-20 12:50:17 【问题描述】:

我使用的是centos,我将python2.7交替安装到默认python。我可以使用 pip 安装我想要的所有模块,但我无法安装 scipy。当我在做的时候

sudo /usr/local/bin/pip2.7 install scipy

它正在下载它,但是我收到以下错误消息:

blas_mkl_info:

  libraries mkl,vml,guide not found in ['/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib']

  NOT AVAILABLE



openblas_info:

  libraries  not found in ['/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib']

  NOT AVAILABLE



atlas_blas_threads_info:

Setting PTATLAS=ATLAS

  libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib64', '/usr/local/lib', '/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64', '/usr/lib']

  NOT AVAILABLE



atlas_blas_info:

  libraries f77blas,cblas,atlas not found in ['/usr/local/lib64', '/usr/local/lib', '/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64', '/usr/lib']

  NOT AVAILABLE



/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1521: 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__)

blas_info:

  libraries blas not found in ['/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib']

  NOT AVAILABLE



/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1530: 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__)

blas_src_info:

  NOT AVAILABLE



/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1533: 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__)

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/scipy/setup.py", line 237, in <module>

    setup_package()

  File "/tmp/pip_build_root/scipy/setup.py", line 234, in setup_package

    setup(**metadata)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 135, in setup

    config = configuration()

  File "/tmp/pip_build_root/scipy/setup.py", line 173, in configuration

    config.add_subpackage('scipy')

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage

    caller_level = 2)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage

    caller_level = caller_level + 1)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py

    config = setup_module.configuration(*args)

  File "scipy/setup.py", line 12, in configuration

    config.add_subpackage('integrate')

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage

    caller_level = 2)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage

    caller_level = caller_level + 1)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py

    config = setup_module.configuration(*args)

  File "scipy/integrate/setup.py", line 12, in configuration

    blas_opt = get_info('blas_opt',notfound_action=2)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py", line 350, in get_info

    return cl().get_info(notfound_action)

  File "/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py", line 509, in get_info

    raise self.notfounderror(self.notfounderror.__doc__)

numpy.distutils.system_info.BlasNotFoundError:

    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.

----------------------------------------
Cleaning up...
Command /usr/local/bin/python2.7 -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-z_rbuN-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

知道如何安装吗?

【问题讨论】:

【参考方案1】:

Scipy 需要在您的系统上安装两个线性代数库。确保安装了以下(或其变体),

sudo yum install blas-devel lapack-devel

【讨论】:

谢谢!为什么 Scipy(或 scikit-learn)网站上的任何地方都没有列出这个要求,这对我来说是个谜。我还编辑了你的答案以包括 gcc-c++,因为 scipy 安装也需要它(在它告诉你之前编译其他东西很长时间后失败)。非常感谢。 @JJC:感谢您的评论。我猜你的编辑被拒绝了,但 gcc-c++ 确实是一个要求。我也尝试过编辑答案,希望这次能被接受。 我已经打开了一个问题并提出了一个拉取请求来提及这一点:github.com/scipy/scipy.org/issues/159 随时改进它或关注问题以查看它何时被接受。

以上是关于在 centos 上安装 scipy 模块的主要内容,如果未能解决你的问题,请参考以下文章

python中如何安装SciPY模块

在 Mac 上安装 Python 包/模块

CentOS安装numpy,scipy

ImportError:没有名为 scipy.sparse 的模块

Centos6.5安装 scipy sciki-learn 一堆报错

python包安装-centos7