CentOS6.5上安装Python2.7和PIP进而安装TensorFlow的shell脚本

安装环境:centos6.5 minimal,x64,全互联网连接

#不执行升级可能也可以
yum upgrade
yum groupinstall "Development tools" -y
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel -y
yum install wget -y
#wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
wget http://mirrors.sohu.com/python/2.7.11/Python-2.7.11.tgz
tar vxf Python-2.7.11.tgz
cd Python-2.7.11
./configure --prefix=/usr/local
make && make install
cd ../
#wget https://pypi.python.org/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz#md5=81964fdb89534118707742e6d1a1ddb4
wget http://pypi.doubanio.com/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz
tar vxf setuptools-21.0.0.tar.gz 
cd setuptools-21.0.0
python setup.py  install
cd ../
#wget https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7
wget http://pypi.doubanio.com/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz
tar vxf pip-8.1.1.tar.gz 
cd pip-8.1.1
python setup.py install
pip
pip install psutil
cd ../
#tensorflow 安装命令
pip install  https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
#安装之后的升级命令
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
#接下来就可以运行了,但。。。
#可能会遭遇ImportError: /lib64/libc.so.6: version 'GLIBC_2.17' not found
ll /lib64/libc.so.6
cd tf/installerpkg/
wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.17.tar.xz
xz -d glibc-2.17.tar.xz
tar xvf glibc-2.17.tar
mkdir glibc-build-2.17
cd glibc-build-2.17/
../glibc-2.17/configure --prefix=/usr
make
make install
ll /lib64/libc*
ll /lib64/libc.so.6
cd ~
#还可能会遭遇ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
ls -l /usr/lib64/libstdc++.so.6
#实际下载太慢,我是下载到本地进行的后续操作。
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.bz2
tar -jxvf gcc-4.8.1.tar.bz2
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir gcc-build-4.8.1
cd gcc-build-4.8.1
#下次可尝试增加prefix=/usr参数试试,这样可能就不需要手动处理下面那个软连接了(已测试完全可以)
../gcc-4.8.1/configure --prefix=/usr --enable-checking=release --enable-languages=c,c++ --disable-multilib
#默认单核,搞了快1个小时,8核十几分钟
make -j8
make install
g++ --version
gcc --version
ll /usr/lib64/libstdc++.so.6
ls /usr/lib64/
ls /usr/local/lib64/
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
#网上看到的是这句,不知道行不行。ln -s /usr/lib64/libstdc++.so.6 /usr/local/lib64/libstdc++.so.6.0.18
ln -s /usr/local/lib64/libstdc++.so.6.0.18 /usr/lib64/libstdc++.so.6
ls /usr/local/lib64/
ls /usr/lib64/
strings /usr/lib64/libstdc++.so.6 | grep GLIBC

安装环境:centos6.5 minimal,x64,半互联网连接

#不执行升级可能也可以
yum upgrade
yum groupinstall "Development tools" -y
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel -y
yum install wget -y
#wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
#wget http://mirrors.sohu.com/python/2.7.11/Python-2.7.11.tgz
cd ~/tf/installerpkg
tar vxf Python-2.7.11.tgz
cd Python-2.7.11
./configure --prefix=/usr/local
make && make install
cd ../
#wget https://pypi.python.org/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz#md5=81964fdb89534118707742e6d1a1ddb4
#wget http://pypi.doubanio.com/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz
tar vxf setuptools-21.0.0.tar.gz 
cd setuptools-21.0.0
python setup.py  install
cd ../
#wget https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7
#wget http://pypi.doubanio.com/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz
tar vxf pip-8.1.1.tar.gz 
cd pip-8.1.1
python setup.py install
pip
pip install psutil
cd ../
#tensorflow 安装命令
pip install  https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
#安装之后的升级命令
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
#接下来就可以运行了,但。。。
#可能会遭遇ImportError: /lib64/libc.so.6: version 'GLIBC_2.17' not found
ll /lib64/libc.so.6
#wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.17.tar.xz
xz -d glibc-2.17.tar.xz
tar xvf glibc-2.17.tar
mkdir glibc-build-2.17
cd glibc-build-2.17/
../glibc-2.17/configure --prefix=/usr
make
make install
ll /lib64/libc*
ll /lib64/libc.so.6
cd ..
#还可能会遭遇ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
ls -l /usr/lib64/libstdc++.so.6
#实际下载太慢,我是下载到本地进行的后续操作。
#wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.bz2
tar -jxvf gcc-4.8.1.tar.bz2
#cd gcc-4.8.1
#此处通过网络下载太慢,更换为本地安装方式。./contrib/download_prerequisites
tar -xjf gmp-4.3.2.tar.bz2
tar -xjf mpfr-2.4.2.tar.bz2
tar -xzf mpc-0.8.1.tar.gz
mv gmp-4.3.2 gcc-4.8.1/gmp
mv mpfr-2.4.2 gcc-4.8.1/mpfr
mv mpc-0.8.1 gcc-4.8.1/mpc
mkdir gcc-build-4.8.1
cd gcc-build-4.8.1
#下次可尝试增加prefix=/usr参数试试,这样可能就不需要手动处理下面那个软连接了(已测试完全可以)
../gcc-4.8.1/configure --prefix=/usr --enable-checking=release --enable-languages=c,c++ --disable-multilib
#默认单核,搞了快1个小时,8核十几分钟
make -j8
make install
g++ --version
gcc --version
ll /usr/lib64/libstdc++.so.6
ls /usr/lib64/
ls /usr/local/lib64/
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
cd ~/tf/t1/
python t1.py

《CentOS6.5上安装Python2.7和PIP进而安装TensorFlow的shell脚本》有一个想法

评论已关闭。