编译依赖于LAPACK、ATLAS的NUMPY

时间:2022-07-17 04:08:29

Python下大多数工具包的安装都很简单,只需要执行 “python setup.py install”命令即可。然而,由于SciPy和numpy这两个科学计算包的依赖关系较多,安装过程较为复杂。

1.LAPACK — Linear Algebra PACKage:

http://www.netlib.org/lapack/

2.Automatically Tuned Linear Algebra Software (ATLAS)

http://math-atlas.sourceforge.net/

https://sourceforge.net/projects/math-atlas/files/

ATLAS编译安装:(参见ATLAS/doc/atlas_install.pdf)

sudo apt-get install gnome-applets

/usr/bin/cpufreq-selector -g performance

cd /home/lu/isce-2.0.0_20160908/ATLAS
mkdir obj64
cd obj64
../configure -b 64 -Fa alg -fPIC –shared –prefix=/usr/local/atlas –with-netlib-lapack-tarfile=/home/lu/isce-2.0.0_20160908/lapack-3.7.0.tgz

make
make check
make ptcheck
make time
sudo make install

3.Numpy

http://www.numpy.org

下载网址:http://github.com/numpy/numpy

NUMPY编译安装:

首先配置numpy目录下的site.cfg文件,指明atlas库的位置:
tar -zxvf numpy-1.8.1.tar.gz
cd numpy-1.8.1
cp site.cfg.example site.cfg
打开site.cfg文件
配置成如下内容:
[DEFAULT]
library_dirs = /usr/local/lib:/usr/local/bin/atlas/lib
include_dirs = /usr/local/include:/usr/local/bin/include
[blas_opt]
libraries = f77blas, cblas, atlas
[lapack_opt]
libraries = lapack, f77blas, cblas, atlas
[amd]
amd_libs = amd
[umfpack]
umfpack_libs = umfpack

接下来配置安装numpy所需要的Fortran编译器类型:
如果前面得到的Fortran编译器是gfortran的话,执行:
python3 setup.py build - -fcompiler=gnu95
如果前面得到的Fortran编译器是g77的话,执行:
python setup.py build - -fcompiler=gnu

然后执行
python setup.py install
安装完成

参考博客地址:
http://blog.chinaunix.net/uid-22488454-id-3978860.html

http://www.myexception.cn/perl-python/1879020.html

http://blog.sina.com.cn/s/blog_4c4668bb01013gsv.html