安装python3.7.3的脚本

#!/bin/bash
#Description: Centos7下python2升级成Python3

download(){ 
    yum install wget zlib* gcc* opensslopenssl-devel    
    wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
    xz -d Python-3.7.3.tar.xz
    tar -xvf Python-3.7.3.tar
}

compile(){
    yum install -y libffi libffi-devel
    cd Python-3.7.3
    ./configure --prefix=/usr/local/python3 --with-ssl --enable-shared
    make && make install
}

create_link(){
    ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
    echo "/usr/local/python3/lib" >/etc/ld.so.conf.d/python3.conf
    ldconfig
    python3 --version
}

main(){
    download
    compile
    create_link
}

main

猜你喜欢

转载自www.cnblogs.com/xiaoyuxixi/p/12237937.html
今日推荐