Tuesday 29 June 2021

Installation Guide Python 3.9.x for CentOS 7.x

About this guide

This Python 3.9.x for CentOS 7.x Installation and Configuration Guide provides information about installing Python from Source Code on CentOS Linux operating system.

Intended Audience

This guide is intended for anyone who wants to install Python and IDLE on CentOS 7.x.

Overview This post will guide you to install your own Python compiler along with IDLE, python IDE (integrated development environment) on CentOS 7.x. We will download source code of latest python version, compile it and check for Python interactive console, denoted by `>>>`

Prerequisites

  • wget package.
  • Python 3.9.6 is latest version at the time of writing this tutorial.
Installation

[root@abc] # wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz

[root@abc] # tar xfvJ Python-3.9.6.tar.xz

[root@abc] # cd Python-3.9.6

[root@abc] # ./configure --prefix=/opt/python3.9.6

[root@abc] # make

###  To make idle3.9, you need tk-development to produce tkinter 

[root@abc] # sudo apt-get install tk8.6-dev

[root@abc] # sudo make install

### Your Python 3.9 interpreter will be located in /opt/python3.9/bin/python3.9.

### Your Integrated Development Environment is also found in /opt/python3.9/bin/idle3.9.

### To facilitate use you can symlink these files to a location on your $PATH like so:

[root@abc] # sudo ln -s /opt/python3.9/bin/python3.9
[root@abc] # /usr/local/bin/py3.9
[root@abc] # sudo ln -s /opt/python3.9/bin/idle3.9
[root@abc] # /usr/local/bin/idle3.9
[user1@abc] $ python3.9 -V

Python 3.9.6