Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code readability with notable use of significant whitespace. Its language structure and object-oriented approach are intended to help programmers write clear, logical code for small- and large-scale projects. It is an incredible programming language that is ideal for both beginners and experienced developers. Some of the most popular websites and applications developed using Python include Dropbox, YouTube, Quora, Reddit, Pinterest, and Instagram.
This tutorial will show you how to install the latest version of Python on your CentOS 7 system. The installation software collections (SCL) and distribution will use the default Python 2.7. We'll also help you learn some basics and create a virtual environment for Python to streamline its use.
Enabling Software Collection (SCL)
The first thing to do when installing Python on CentOS 7 is to enable software archives. Software archive is a utility that allows to execute an application that is not located in the file system root hierarchy but exists in an alternate location.
When SCLs are enabled they seamlessly allow you to use the latest version of services and programming languages that may not be present in the main repository. Run the command below to install the release files for SCL. The release file is a component of the CentOS Additional Repository.
# yum install centos-release-scl
enable python 3
You should already have Software Archive enabled. This means you can implement any Python 3 version: Python3.3, Python3.4, Python3.5, Python3.6. This tutorial will focus on Python3.4. To enable it you need to run:
# yum install rh-python34
After this the application will be installed.
After successfully installing the following package you need to activate it with the command:
# scl enable rh-python34 bash
The above command will call /opt/rh/rh-python34/enable; A script that changes shell environment variables. Now, if you verify your Python version:
# python3 --version Python 3.4.0
That’s it! You have successfully installed Python 3.4 on your CentOS system and it should be easy to use the Python programming language to develop a new application.