如何告诉Python安装Atlas的位置

时间:2014-03-01 18:12:14

标签: python scikit-learn atlas

我目前正在没有root访问权限的计算机上安装Python的scikit-learn软件包。在Fedora 14上使用Python 2.7。

pip没有安装,所以我使用的是easy_install:

easy_install --prefix=$HOME/.local -U scikit-learn

安装过程抱怨没有安装BLAS。我过去曾尝试安装scipy,但在查找和安装Atlas / BLAS时遇到了麻烦。从那时起,我已经检查过numpy对Atlas没有问题:

>>> import numpy as np
>>> np.__config__.show()
atlas_threads_info:
    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib/atlas']
    language = f77
    include_dirs = ['/usr/include']

blas_opt_info:
    libraries = ['ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib/atlas']
    define_macros = [('ATLAS_INFO', '"\\"3.8.3\\""')]
    language = c
    include_dirs = ['/usr/include']

atlas_blas_threads_info:
    libraries = ['ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib/atlas']
    language = c
    include_dirs = ['/usr/include']

lapack_opt_info:
    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib/atlas']
    define_macros = [('ATLAS_INFO', '"\\"3.8.3\\""')]
    language = f77
    include_dirs = ['/usr/include']

lapack_mkl_info:
  NOT AVAILABLE

blas_mkl_info:
  NOT AVAILABLE

mkl_info:
  NOT AVAILABLE

/usr/lib/atlas存在,并包含.so文件。

这是easy_install存在的错误:

error: Setup script exited with error: Command "gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c sklearn/__check_build/_check_build.c -o build/temp.linux-i686-2.7/sklearn/__check_build/_check_build.o" failed with exit status 1
/usr/lib/python2.7/site-packages/numpy/distutils/misc_util.py:248: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import
  from numpy.distutils import log

安装前面的警告:

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

所以安装过程似乎无法找到numpy或Atlas。我如何告诉它在哪里找到它们?

3 个答案:

答案 0 :(得分:0)

我更愿意在评论中提出这个问题但是没有足够的声誉这样做:

export ATLAS=/usr/lib/atlas/libatlas.so之前的easy_install会有帮助吗?

答案 1 :(得分:0)

如果您没有root访问权限,并且想要安装自己的模块,那么virtualenv就是您的选择。

要设置一个默认环境,请执行以下操作:

$ pip install virtualenv
$ virtualenv ~/.default_env

# Add the activate script to the bashrc

$ echo "source ~/.default_env/bin/activate

在此之后,你可以使用pip或easy_install来安装你想要的任何软件包。

答案 2 :(得分:0)

从源代码安装numpy和scipy有时会很棘手。如果你想要一个简单的出路,我建议安装一个科学的python发行版,它将安装一个包含所有必需库的单独python。有几个选项,我推荐来自continuum.io的anaconda,你可以download here