首页 > 代码库 > SciPy安装

SciPy安装

平台:Linux version 2.6.32-220.13.1.el6.x86_64 (mockbuild@c6b6.bsys.dev.centos.org) (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.tgztar xzf blas.tgzcd 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 g77gfortran -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 *.oranlib libfblas.arm -rf *.oexport BLAS=~/src/BLAS/libfblas.a

安装Lapack:

mkdir -p ~/srccd ~/src/wget http://www.netlib.org/lapack/lapack.tgztar xzf lapack.tgzcd 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 lapacklibmake cleanexport LAPACK=~/src/lapack-*/libflapack.a

 

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

python setup.py install --prefix=YourDir

成了:-)

 

问题与解决方案:

1)老问题,权限不足

解决方案:

修改PATH。

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

# include head file when compiling  cC_INCLUDE_PATH=YourDirexport C_INCLUDE_PATH#include head file when compiling c++CPLUS_INCLUDE_PATH=YourDirexport CPLUS_INCLUDE_PATH#import lib diractoryLIBRARY_PATH=YourDirexport LIBRARY_PATH

 

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

 

SciPy安装