Install Python 3.5.1 on CentOS/RHEL 7/6

Python 3.x is a new version of the language, which is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. You can also know more features in python 3.5
Install Python

Step #1 Require Package

Firstly make sure that all require packages installed on your system. Use following command to install all packages:

# yum install gcc

Step #2 Download Python 3.5

Download Python using following command and you can also download latest version from python official site.

# cd /opt
# wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

Step #3 Extract Archive and Compile

Use below commands to extract Python source code and compile it on your system using altinstall.

# tar xzf Python-3.5.1.tgz
# cd Python-3.5.1
# ./configure
# make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Step #4 Check the Python Version

Check the latest version installed of python using below command

# python3.5 -V
Or
# python3.5 --version
Python 3.5.1

Reference:

  • https://docs.python.org/3.5/
  • Enjoy it!

    Comments
    1. 8 years ago
    2. 8 years ago

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.