install dependencies first
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
this pack may not necessaryyum install libffi-devel -y
download & compile
1 | wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz |
modify default setting
python3.7 locate in /usr/local/bin
in default
we need to change default python2.7 to python3.7
1 | # backup |
modify pip
1
2
3
4# backup
mv /usr/bin/pip /usr/bin/pip.bak
# soft link
ln -s /usr/local/bin/pip3 /usr/bin/pip
modify yum
setting
yum
not support python3, so we need point to python2 manually.
vi /usr/libexec/urlgrabber-ext-down
vi /usr/bin/yum
modify the first line to #! /usr/bin/python2.7