numpy, scipyのLinuxへのインストール

(今はenthoughtを使うとか、もっと効率的な方法がある)

BLAS
mkdir -p ~/src/blas
cd ~/src/blas
tar xzf blas.tgz
# When using GNU compiler:
g77 -fno-second-underscore -O2 -c *.f
# OR
# On 64 bit systems with GNU compiler:
g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f
# OR
# Intel compiler:
ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f
ar r libfblas.a *.o
ranlib libfblas.a
rm -rf *.o
export BLAS=~/src/blas/libfblas.a 
 
mkdir -p ~/src
tar xzf lapack.tgz
cd ~/src/LAPACK
cp INSTALL/make.inc.LINUX make.inc             # on LINUX
# Edit make.inc as follows:
PLAT = _Linux
OPTS = -O2
# OR
# On 64 bit systems with GNU compiler:
PLAT = _Linux
OPTS = -O2 -m64 -fPIC
NOOPT = -m64 -fPIC
# OR
# For Absoft (8.x or later):
PLAT = _Linux
OPTS = -O3 -YNO_CDEC
# On LINUX with Intel Fortran compiler:
cp make.inc.LINUX_IFC make.inc
make lapacklib
make clean
cp lapack_LINUX.a libflapack.a                 # on LINUX
export LAPACK=~/src/LAPACK/libflapack.a
NOTE: scipy may not find the libf* names.  You may have to make a symbolic link from these files to libblas.a and liblapack.a  Numpy does not seem to have this problem.
NOTE: lapack-3.2.1 no longer has INSTALL/make.inc.LINUX, try using INSTALL/make.inc.gfortran instead.
 
・ATLAS
wget (Atlas ftp site)
cd /path/to/src/ATLAS
mkdir ATLAS_Linux
cd ATLAS_Linux/
../configure -Fa alg '-fPIC -m64' -Ss flapack ~/Library/LAPACK/libflapack.a # for 64 bit, maybe -m64 is unnecessary.
 
cd /path/to/src/ATLAS/ATLAS_Linux/lib
mkdir tmp; cd tmp
ar x ../liblapack.a
cp /path/to/src/LAPACK/lapack_LINUX.a ../liblapack.a
ar r ../liblapack.a *.o
cd ..; rm -rf tmp 
 
   * Move all ``lib*.a`` files from ``/path/to/src/LAPACK/lapack_LINUX.a ../liblapack.a``,
     say, to ``/usr/local/lib/atlas/``.
     Also copying ``/path/to/src/ATLAS/include/{cblas.h,clapack.h}`` to
     ``/usr/local/lib/atlas/`` might be a good idea.
   * Define environment variable ATLAS that contains path to the directory
     where you moved the atlas libraries. For example, in bash run::
       export ATLAS=/usr/local/lib/atlas 
 
・Numpyビルド上の注意
To build NumPy, only a C compiler is required. 
If you see an error message 

ImportError: /usr/lib/atlas/libblas.so.3gf: undefined symbol: _gfortran_st_write_done
when building SciPy, it means that NumPy picked up the wrong Fortran compiler during build (e.g. ifort). Recompile NumPy using: 
python setup.py build --fcompiler=gnu95
or whichever is appropriate (see python setup.py build --help-fcompiler).