Objective

The objective is to install Python 3 on CentOS 7 with Software Collections (SCL).

Operating System and Software Versions

  • Operating System: - CentOS 7 or higher

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Difficulty

EASY

Conventions

  • # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given linux commands to be executed as a regular non-privileged user

Instructions

Default Python Version

First, check your default python version. This can be done by execution of the following linux command:
$ python --version
check python version on centos
Check the default python version on your current CentOS 7 system.

Set up Software Collections (SCL)

The following command will install Software Collections and allow you to run applications from SCL shell:
$ sudo yum install centos-release-scl scl-utils-build

Install Python 3

At this stage we are ready to install Python 3. To do so execute the following command on your CentOS 7 system's terminal:
$ sudo yum install python33

Run applications under Python 3

The Python 2 is still your default shell. However, to run application under Python 3 you first need to enter the SCL shell with Python 3 installation. The following command will do just that:
$ scl enable python33 bash
Next, check your Python version:
$ python --version
Python 3.3.2
Now you are ready to start any of your applications from SCL shell using Python 3 as a default python interpreter.
CentOS 7 with Python 3
CentOS 7 with Python 3
Please refer all article related questions to:

You may also be interested in: