新建shell文件,installPython.sh
/bin/rm -fr /usr/local/python3
wget https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1j.tar.gz --no-check-certificate
tar xf openssl-1.1.1j.tar.gz
cd openssl-1.1.1j
./config --prefix=/usr/local/openssl-1.1.1j
make && make install
echo "/usr/local/openssl-1.1.1j/lib/" >/etc/ld.so.conf.d/openssl.conf
ldconfig
yum -y install libffi-devel
yum -y install zlib
yum -y install zlib-devel
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz
cd Python-3.7.0
./configure prefix=/usr/local/python3 --with-openssl=/usr/local/openssl-1.1.1j
make && make install
/usr/local/python3/bin/python3 -V
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/usr/local/python3/bin/python3 /opt/get-pip.py
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pyaml==19.12.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pycparser==2.19
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyGithub==1.45
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyJWT==1.7.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pymongo==3.10.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyMySQL==0.9.3
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ smmap2==2.0.5
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ soupsieve==2.0.1
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ texttable==1.6.2
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ urllib3==1.25.7
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ websocket-client==0.48.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ wrapt==1.11.2
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlrd==1.2.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlutils==2.0.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlwt==1.3.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ zipp==1.0.0
/usr/local/python3/bin/pip3 install -i https://mirrors.aliyun.com/pypi/simple/ pyautogui==0.9.52
yum -y install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false
腳本裡安裝python和pip是全的,
下面安裝python依賴,需要更換成自己需要的依賴包。
運行shell腳本
sh installPyhton.sh