How to Install Python 3 on CentOS

Python 2.7 is installed by default on CentOS but we can install other versions like Python 3.9 and 3.10 . In this tutorial, we will install python
2 min read

How to Install Python 3 on CentOS

Introduction

Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows developers to use fewer lines of code than any other programming language. It basically focuses on the code readability of program. Python 2.7 is installed by default on CentOS but we can install other versions like Python 3.9 and 3.10 . In this tutorial, we are learning how to install Python 3.6.3 on CentOS.

Prerequisites

  • CentOS
  • Login as an administrator on the terminal
  • Yum must be configured on the system.

Installation

Installation includes following steps.

1. Install IUS community Repository

In order to install Python 3.6 on CentOS, we need to first install IUS community repository which provides extra packages for Enterprise Linux. Execute the following command to install IUS community repository.

  1. $ sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm   
CentOS How to Install Python 3 on CentOS

2. Install Python 3

Execute the following command to install python 3.6 on CentOS.

  1. $ sudo yum install python36u   
CentOS How to Install Python 3 on CentOS 1

3. Verify Python

To verify if we have installed correct version of python, we just need to type python3.6 -V on the terminal. The command will show the version installed which is 3.6.4 in my case.

CentOS How to Install Python 3 on CentOS 2

4. Working on Python's script mode

Just type python3.6 on the terminal to enter the Python's script mode. We can execute the python statements on this shell. Since, python 2 is by default installed on CentOS, hence typing python on the terminal takes us to the python2 shell, hence we have to type python3.6 to work on the desired python shell.

CentOS How to Install Python 3 on CentOS 3

Execute the valid python statements which get interpreted and show the desired output on the terminal as shown below.

CentOS How to Install Python 3 on CentOS 4

Hence, we have installed and get started with Python 3.

Installation on MacOS

To install python3 on MacOS, visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python3-on-macos.html and follow the instructions given in the tutorial.

Installation on Windows

To install Python3 on CentOS, visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python-on-windows.html and follow the instructions given in the tutorial.

Installation on Ubuntu

To install Python3 on Ubuntu, visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python-on-ubuntu-2004-lts.html and follow the instructions given in the tutorial.

 

 

Men' fashion , Dating Tips , Relationship Advice

You may like these posts

  •  How to Install Python (Environment Set-up) In order to become Python developer, the first step is to learn how to install or update Python on a local machine or computer. I…
  • How to Install Python 3 on CentOS Introduction Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows dev…
  • In the previous tutorial on Basic Data Types in Python, you saw how values of various Python data types can be created. But so far, all the values shown have been literal or c…
  • How to Install Python3 on MacOS Introduction Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows deve…
  • How to install Python on Ubuntu 20.04 LTS? Introduction Python is a high level, dynamic and general purpose programming language. It was designed and developed by Python Software…
  • How to Read files in Python? To read a file in Python, you can use the built-in open() function to open the file, and then use the .read() method to read its contents. For exa…

Post a Comment