部署Python3

一键部署Python 3.7.6

#!/bin/bash
#
#
python () {
     
        yum -y install gcc gcc-c++ make zlib-devel bzip2-devel openssl-devel  sqlite-devel readline-devel  libffi-devel wget &>/dev/null
        cd /tmp/
        wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz  &>/dev/null
        tar xf Python-3.7.6.tgz
        cd Python-3.7.6
        cd /tmp
        sed -ri 's/^#readline/readline/' Modules/Setup.dist
        sed -ri 's/^#(SSL=)/\1/' Modules/Setup.dist
        sed -ri 's/^#(_ssl)/\1/' Modules/Setup.dist
        sed -ri 's/^#([\t]*-DUSE)/\1/' Modules/Setup.dist
        sed -ri 's/^#([\t]*-L\$\(SSL\))/\1/' Modules/Setup.dist
        cd Python-3.7.6
        ./configure --enable-shared
        make  && make install
        file="/etc/profile.d/python3_lib.sh"
        echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >$file
        path="/usr/local/lib/"
        file2="/etc/ld.so.conf.d/python3.conf"
        echo $path > $file2
        ldconfig
 source /etc/profile
        mkdir ~/.pip
        echo '[global]' >> ~/.pip/pip.conf
       c1="index-url=https://mirrors.aliyun.com/pypi/simple"
       echo "${c1}" >> ~/.pip/pip.conf
       pip3  install ipython
       pip3 install --upgrade pip
}
python

你可能感兴趣的:(python,爬虫,python)