python2.7.5升级到2.7.14
1.安装升级GCC
yum install -y gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel zlib python-devel mysql-devel openldap-devel
2.下载python安装包
wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
3.解压
8.安装setuptools
wget --no-check-certificate https://pypi.python.org/packages/69/56/f0f52281b5175e3d9ca8623dadbc3b684e66350ea9e0006736194b265e99/setuptools-38.2.4.zip#md5=e8e05d4f8162c9341e1089c80f742f64
unzip setuptools-38.2.4.zip
cd setuptools-38.2.4
python setup.py install
cd ..
9.安装pip
wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
tar -xvf 1.5.5.tar.gz #解压文件
cd pip-1.5.5/
python setup.py install
python2.7.5升级到3.6.4
yum install -y gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel zlib python-devel mysql-devel openldap-devel
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar -xvf Python-3.6.4.tar.xz
cd Python-3.6.4
mkdir -p /usr/local/python3
./configure --prefix=/usr/local/python3
make && make install
mv /usr/bin/python /usr/bin/python2.7.5
mv /usr/bin/pip /usr/bin/pip2.7
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip
[root@k8s-registry-91 Python-3.6.4]# pip -V
pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)
[root@k8s-registry-91 Python-3.6.4]# python -V
Python 3.6.4
[root@k8s-registry-91 Python-3.6.4]# which python
/usr/bin/python
[root@k8s-registry-91 Python-3.6.4]# which pip
/usr/bin/pip
[root@k8s-registry-91 Python-3.6.4]#