Created
November 23, 2015 03:17
-
-
Save ningyuwhut/641b1b12fa3a52195d45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#执行前先进入root权限 | |
#安装前要看一下python2.7是否已安装 | |
#如何判断是否已安装 | |
#python2.7 | |
echo "start install python2.7" | |
rm -r Python-2.7.10 | |
rm -rf /usr/local/lib/python2.7 | |
tar xzvf Python-2.7.10.tgz | |
cd Python-2.7.10 | |
./configure --prefix=/usr/local | |
make | |
make install | |
PATH=/usr/local/bin/:$PATH | |
cd .. | |
echo "end install python2.7" | |
nose | |
echo "start install nose" | |
rm -r nose-1.3.7 | |
tar xzvf nose-1.3.7.tar.gz | |
cd nose-1.3.7 | |
python2.7 setup.py install | |
cd .. | |
echo "end install nose" | |
echo "start install lapack" | |
rm -rf lapack-3.5.0 | |
tar xzvf lapack-3.5.0.tgz | |
cd lapack-3.5.0 | |
cp INSTALL/make.inc.gfortran make.inc | |
##lapack | |
sed -i '16s/frecursive/fPIC/' make.inc | |
sed -i '18s/frecursive/fPIC/' make.inc | |
##在OPTS和NOOPT后面加上选项-fPIC | |
##OPTS = -O2 -frecursive -fPIC | |
##NOOPT = -O0 -frecursive -fPIC | |
cd SRC | |
make | |
cd ../.. | |
echo "end install lapack" | |
#atlas | |
echo "start install atlas" | |
rm -rf ATLAS | |
tar -xjvf atlas3.10.2.tar.bz2 | |
cd ATLAS | |
cd ATLAS | |
## | |
mkdir atlas_rhel | |
cd atlas_rhel | |
../configure -Fa alg -fPIC --with-netlib-lapack-tarfile=../../lapack-3.5.0.tgz | |
echo "SMAFLAGS = -fno-tree-loop-optimize" >> Make.inc | |
echo "DMAFLAGS = -fno-tree-loop-optimize" >> Make.inc | |
make | |
cur_dir=$(pwd) | |
echo $cur_dir/ATLAS/atlas_rhel | |
export LD_LIBRARY_PATH=$cur_dir/ATLAS/atlas_rhel/lib:$LD_LIBRARY_PATH | |
cd ../../ | |
echo "end install atlas" | |
#numpy | |
echo "start install numpy" | |
rm -rf numpy-1.9.2 | |
unzip numpy-1.9.2.zip | |
cd numpy-1.9.2 | |
cp site.cfg.example site.cfg | |
echo "[DEFAULT]" >> site.cfg | |
echo "library_dirs = $cur_dir/lib" >> site.cfg | |
echo "include_dirs = $cur_dir/lib" >> site.cfg | |
echo "[atlas]" >> site.cfg | |
echo "atlas_libs = lapack, f77blas, cblas, atlas" >> site.cfg | |
python2.7 setup.py build | |
python2.7 setup.py install | |
cd .. | |
echo "end install numpy" | |
#scipy | |
echo "start install scipy" | |
rm -rf scipy-0.16.0b2 | |
unzip scipy-0.16.0b2.zip | |
cd scipy-0.16.0b2 | |
cp ../numpy-1.9.2/site.cfg . | |
python2.7 setup.py build | |
python2.7 setup.py install | |
cd .. | |
echo "end install scipy" | |
#sklearn | |
echo "start install sklearn" | |
rm -rf scikit-learn-0.16.1 | |
tar xzvf scikit-learn-0.16.1.tar.gz | |
cd scikit-learn-0.16.1 | |
python2.7 setup.py build | |
python2.7 setup.py install | |
cd .. | |
echo "end install sklearn" | |
exit | |
echo "start install setuptools" | |
rm -rf setuptools-18.0.1 | |
tar xzvf setuptools-18.0.1.tar.gz | |
cd setuptools-18.0.1 | |
python setup.py install | |
cd .. | |
echo "end install setuptools" | |
echo "start install python-dateutil" | |
rm -rf python-dateutil-1.5 | |
tar xzvf python-dateutil-1.5.tar.gz | |
cd python-dateutil-1.5 | |
python setup.py install | |
cd .. | |
echo "end install python-dateutil" | |
echo "start install cython" | |
rm -rf Cython-0.22.1 | |
tar xzvf Cython-0.22.1.tar.gz | |
cd Cython-0.22.1 | |
python setup.py build | |
python setup.py install | |
cd .. | |
echo "end install cython" | |
echo "start install pytz" | |
rm -rf pytz-2015.4 | |
tar xzvf pytz-2015.4.tar.gz | |
cd pytz-2015.4 | |
python setup.py install | |
cd .. | |
echo "end install pytz" | |
echo "start install pandas" | |
rm -rf pandas-master | |
unzip pandas.zip | |
cd pandas-master | |
python setup.py build | |
python setup.py install | |
cd .. | |
echo "end install pandas" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这是在red hat上从源码开始安装scikit-learn即其依赖包(lapack,atlas,numpy,scipy)和pandas及其依赖包的脚本,运行前需要把各种包都下载并放到脚本所在目录,根据版本不同可能需要修改程序。
这些包中比较难装的是atlas,编译的时间特别长,最短可能也要1个多小时吧,久了就说不清了。如果atlas安装不上的话,scipy就会安装失败,不过貌似对numpy没有影响