centos7 安装python3.6 脚本

shell 脚本自动安装python3

# /bin/bash

cd /opt
yum groupinstall "Development tools" -y
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz
if [ -f /opt/Python-3.6.6.tar.xz ];then
    tar -xf Python-3.6.6.tar.xz
    cd /opt/Python-3.6.6
    ./configure --prefix=/usr/local/python3 --enable-optimizations
    if [ $0 == 0 ];then
        make && make install
        ln -s /usr/local/python3/bin/python3 /usr/bin/python3
        ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
    else
        echo "./configure 出现错误"
    fi
else
    echo "下载失败"
fi

猜你喜欢

转载自www.cnblogs.com/zhengyionline/p/9253636.html