Upgrade python3.5.2 under Linux (CentOS)

Source: Internet
Author: User

The Python version under CentOS is generally low, and many applications need to be upgraded to Python. The default Python version I installed for CentOS is V2.6.3, but the version that runs node. JS needs to be above 2.5.


1. To download the python3.3 installation package:

Yum Install readline-devel.x86_64


wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz


2. Unzip the installation package: TAR-ZXVF python-3.5.2.tgz

3. Enter the extracted directory: CD Python-3.5.2


4. Create the installation directory: mkdir/usr/local/python3.5

5. Compile and install:./configure--prefix=/usr/local/python3.5


6. Execute: Make && make install


7. The new version of the installation is complete, but since the old version is still in the system, you need to change the original/usr/bin/python link to a new connection:

A. Modify the old connection first, execute: Mv/usr/bin/python/usr/bin/python_bak.

B. Re-establishing a new connection: Ln-s/usr/local/python3.5/bin/python3.5/usr/bin/python

C. Setting environment variables path= $PATH:/usr/local/python3.5/bin/


8. Querying Python version, executing: Python--version

Python 3.5.2


The installation is successful.


Modify the Yum Python parser to Python2.6

Vim/usr/bin/yum #修改第一行


#!/usr/bin/python2.6



If the custom-installed Python 3.5.2 backspace and arrows do not work,

Yum Install readline-devel.x86_64


Re-configure, make, make install, done!!



[email protected] ~]# cat python_install.sh

#!/bin/bashyum Install READLINE-DEVEL.X86_64VERSION=2.7.9MAIN=2.7CD ~wget https://www.python.org/ftp/python/$ version/python-$version. TGZTAR-ZXVF python-$version. TGZCD python-$versionmkdir/usr/local/python$version./ Configure--prefix=/usr/local/python$versionmake && make Installmv/usr/bin/python/usr/bin/python_bakln-s/ Usr/local/python$version/bin/python$main/usr/bin/pythonpath= $PATH:/usr/local/python$version/python--versioncd ~ RM-RF python-$version. tgz python-$version



Upgrade python3.5.2 under Linux (CentOS)

Related Article

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.