Linux Python升级到3.6.5

#!/bin/bash
python_old_version=$(python -V | awk '{print $NF}')
python_dir=$(dirname $(which python))
yum groupinstall "Development tools" -y
sed -i "s%#!/usr/bin/python%#!/usr/bin/python.${python_old_version}%" /usr/bin/yum

cd
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xf Python-3.6.5.tar.xz
cd Python-3.6.5
./configure --prefix=/usr/local/python3
make && make install
mv ${python_dir}/python ${python_dir}/python.${python_old_version}
ln -s /usr/local/python3/bin/python3.6 ${python_dir}/python
if [[ `python -V` == "Python 3.6.5" ]] ;then
    echo "Upgrade python to 3.6.5 successfully";
fi

猜你喜欢

转载自blog.csdn.net/firehive/article/details/80026216