Introduction
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 its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects. It’s an incredible programming language that is ideal for both beginners and well-versed 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 will utilize the Software Collections (SCL) and distribution default Python 2.7. We’ll also help you learn some basics and create a virtual environment for Python to streamline its usage.
Enabling Software Collections (SCL)
The first thing when installing Python on CentOS 7 is enabling the Software Collections. The Software Collection is a utility that allows executing an application that is not located in the filesystem root hierarchy but is present in an alternative location.
When the SCLs are enabled they grant you unfettered permissions to use the latest version of services and programming languages that may not be present in the main repositories. 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 have already enabled Software Collection. It means that you can implement any python 3 version: python3.3, python3.4, python3.5, python3.6. On this tutorial will focus on python3.4. To enable it you need to run:
# yum install rh-python34
After that application will be installed.
Using python3.4
After you successfully install following package you had to activate it with command:
# scl enable rh-python34 bash
The command above will call /opt/rh/rh-python34/enable; a script that changes the variables of a shell environment. Now, if you verify your Python version:
# python3 --version Python 3.4.0
Conclusion
That’s it! You have successfully installed Python 3.4 on your CentOS system and it should be easy to utilize Python programming language to develop a new application.