Centos7 default installation is 2.7, here choose to install using Python3.6.3
Installing Python3.6.3
1, install the Python3 need to rely on the package
Yum install-y openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc cc
2. Download Python source code
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
3. Unzip and compile
Mkdir/usr/local/python3-Ptar XF python-3.6.3. TGZCD python-3.6.3. /configure--prefix=/usr/local/python3makemake Install
4. Back up the old version of Python soft link, link the new version of Python
[[Email protected] ~] # ls-l/usr/bin/pythonlrwxrwxrwx. 1 root root 9 Oct 14:08/usr/bin/python~]# ls-l/usr/bin/python2lrwxrwxrwx. 1 root root 9 Oct 14:08/usr/bin/python2-python2.7~]# ls-l/usr/bin/python2.7-RWXR-XR -X. 1 root root 7136 5 2016/usr/bin/python2.7
mv/usr/bin/python/usr/bin/-s/usr/local/python3/bin/python3/usr/bin/-s/usr/local/python3/bin/ Pip3/usr/bin/pip
5. Modify the Yum configuration file
vim/usr/bin//usr/libexec/urlgrabber-ext-down
Change the python version specified in the first line to python2.7 (#!/usr/bin/python to #!/usr/bin/python2.7)
6. Check Python and PIP version
[[Email protected] ~] # python-v Python 3.6.3~]# pip-v from/usr/local/python3/lib/python3.6/site-packages ( Python 3.6)
Reference Original Address: HTTP://MP.WEIXIN.QQ.COM/S/9FLUQSWADWKYAUMYIXF8DW (provides another way of coexistence)
Installing python3.x on Centos 7