SciPy安装

平台:Linux version 2.6.32-220.13.1.el6.x86_64 ([email protected]) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Tue Apr 17 23:56:34 BST 2012

具体过程:

安装BLAS:

mkdir -p ~/src/
cd ~/src/
wget http://www.netlib.org/blas/blas.tgz
tar xzf blas.tgz
cd BLAS

## NOTE: The selected fortran compiler must be consistent for BLAS, LAPACK, NumPy, and SciPy.
## For GNU compiler on 32-bit systems:
#g77 -O2 -fno-second-underscore -c *.f                     # with g77
#gfortran -O2 -std=legacy -fno-second-underscore -c *.f    # with gfortran
## OR for GNU compiler on 64-bit systems:
#g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f                     # with g77
gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f    # with gfortran
## OR for Intel compiler:
#ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f

# Continue below irrespective of compiler:
ar r libfblas.a *.o
ranlib libfblas.a
rm -rf *.o
export BLAS=~/src/BLAS/libfblas.a

安装Lapack:

mkdir -p ~/src
cd ~/src/
wget http://www.netlib.org/lapack/lapack.tgz
tar xzf lapack.tgz
cd lapack-*/
cp INSTALL/make.inc.gfortran make.inc          # on Linux with lapack-3.2.1 or newer
#这里要修改下make.inc中的一些内容
#FORTRAN  = gfortran
#OPTS     = -O2 -frecursive -m64 -fPIC
#DRVOPTS  = $(OPTS)
#NOOPT    = -O0 -frecursive -m64 -fPIC
#LOADER   = gfortran
#LOADOPTS =
#以上是我安装成功时的参数
make lapacklib
make clean
export LAPACK=~/src/lapack-*/libflapack.a

下载scipy包,解压,进入目录

python setup.py install --prefix=YourDir

成了:-)

问题与解决方案:

1)老问题,权限不足

解决方案:

修改PATH。

这次还遇上了GCC调用服务器默认库,无法找到账户上的python2.7,所以查到GCC库文件导入的方法,还有头文件导入方法,一并记录下吧

# include head file when compiling  c
C_INCLUDE_PATH=YourDir
export C_INCLUDE_PATH

#include head file when compiling c++
CPLUS_INCLUDE_PATH=YourDir
export CPLUS_INCLUDE_PATH

#import lib diractory
LIBRARY_PATH=YourDir
export LIBRARY_PATH

参考:http://stackoverflow.com/questions/7496547/python-scipy-needs-blas

你可能感兴趣的:(SciPy安装)