Installing python3.x on Centos 7

Source: Internet
Author: User

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


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


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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.