2019 04 11 初写自动安装Python脚本,以后完善
#!/bin/bash
if ! ping -c2 www.baidu.com &> /dev/null
then
echo yum is bad
exit
fi
yum -y install gcc gcc-c++ zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel
ce(){
if [ $? -eq 0 ]
then
echo -e "\033[32m ok \033[0m"
else
echo "-e \033[32m no \033[0m"
exit
fi
}
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
ce
if [ ! -e $file ];then
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz --no-check-certificate
fi
tar xf Python-3.6.5.tar.xz -C /usr/local/src/
cd /usr/local/src/Python-3.6.5
sed -ri '/^#readline/ s/^#//' Modules/Setup.dist
sed -ri '/^#SSL=/,/-lcrypto$/ s/^#//' Modules/Setup.dist
ce
./configure --enable-shared
make && make install
ce
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" > /etc/profile.d/python3_lib.sh
source /etc/profile
echo "/usr/local/lib" >/etc/ld.so.conf.d/python3.conf
source /etc/profile
ldconfig
ce