Installing Python is a straightforward process and due to Python's relatively small size, the installation doesn't take a lot of  disk space. 

To install Python  in your machine, you will first need to download a version of Python's  installer, preferably the latest  release  from the official website. As of writing of this post , the latest version is 3.11.2

There are two major distribution of Python i.e Python 2 and Python 3 , Python 2 reached its climax when Python software announced that there will be no more future improvements to it. You should , avoid Python 2 as a beginner unless you really have some personal reasons for learning it.  Python 3 is the most modern version and also the most widely used in modern software development . When you encounter the name Python, it is safe to assume that we are talking about Python 3 unless it is stated otherwise. 

Before we start , you can check whether Python is already installed in your computer by running the following command in the command interface

python --version

If Python is installed, you should get the version of Python installed, the image below shows the results of running the above command on windows command line when Python 3.11.2 is installed. 

the version of python installed

if you get an error or some other results , Python is not installed. You might also want to install another version of Python other than the one already installed.

Let us look at how to install Python on the major  operating systems.

installing on windows

If you are running on a windows system , follow these steps.

  1. visit http://www.Python.org 
  2. Click  the download link of the latest Python release

latest python version download link image

  1. Scroll down and you should see several installation links under the files sub heading, download the one which matches the windows platform you are in. Most likely you are in a 64-bit machine. You can check whether you are on a 32-bit or 64-bit device by going to  Start > Settings > System > About  then check the bit version under the Device specifications System type.

  64-bit installer link

if you are on a 32-bit which is highly unlikely, you should choose the 32-bit installer.

The Python installer should now start downloading

  1. Click the just downloaded installer to open Python's setup wizard

When the setup window opens, you are only one click away to having Python running in your windows computer. There is only one very important thing which you should not dare to  forget and that is checking the checkbox at the bottom  to add Python to path.adding python to path image

Make sure that you do not forget to  check the highlighted checkbox, this ensures that you will not have to add Python to path by yourself. Adding an executable like Python to path allows the operating system to understand whenever you reference that executable with it's alias name, for example whenever you will need to run Python in the command line, you will not have to provide the full path where Python's executable is located, you will only use the name 'Python'.

You can now  click the  install now  link and the installation will start immediately. You should now see the progress bar to show that Python is being installed in your computer.

python installation progress

The installation will take less than 5 minutes

 

You can  verify that Python installation was successful by opening your computer's command interface and running the following command.

python --version

You should see the version of Python you have just installed in your computer if there is no another version which was already installed and added on system's path.

 

 

Installing Python on Linux

Python comes pre-installed on most  Linux distributions such as Ubuntu , fedora and Debian,  You can confirm that Python is installed by running  the command to check version mentioned above.
 

If  Python does not exist on your Linux distribution ,  you can use the following  methods to  install Python :

  1. using a package manager
  2. Building from source
  3. Using the graphical Linux Installation (on some linux distribution)
using a package manager

This method relatively easy and straightforward . You will only have to run the command shown below  in almost every distribution of Linux, and the latest version will be installed

sudo apt-get update
sudo apt-get install python3

To install a specific version you can run the install command and specify the version for example:

sudo apt-get update
sudo apt-get install python3.11.2
Building from source

In this method you will first need to install some required dependencies  before installing Python:

on Ubuntu and Debian

Run the following commands in the Linux terminal

sudo apt-get update
sudo apt-get install gdebi-core
sudo apt-get build-dep python
sudo apt-get install libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev

You will need to specify the Python version you want to install  by running the below command, in this case will specify the latest version of Python :

export PYTHON_VERSION=3.11.2
export PYTHON_MAJOR=3

Run the below commands to download and extract Python:

download

curl -O https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tgz

extract

tar -xvzf Python-3.11.2.tgz

then  change directory to the new Python directory. make sure all the following  commands upto to the installation are run in this directory.

cd Python-3.11.2

 

To  configure Python for installation run :

./configure \
    --prefix=/opt/python/3.11.2 \
    --enable-shared \
    --enable-optimizations \
    --enable-ipv6 \
    LDFLAGS=-Wl,-rpath=/opt/python/3.11.2/lib,--disable-new-dtags

Lastly  run the make and install commands:

make
sudo make install
Install Python's package manager - pip

To install the Python's package manager- pip run the below command on the terminal

curl -O https://bootstrap.pypa.io/get-pip.py
sudo /opt/python/python3/bin/python3 get-pip.py
 
Using the Graphical  Linux Installation

Some versions of Linux  such as Ubuntu 12.x  onwards supports  graphical installation. You will need  an administrator password before starting the installation. You can follow the following steps on Ubuntu and some other Linux installations to install Python on Graphical Linux:

  1. Open the Ubuntu Software Center folder. (The folder may be named Synaptics on other platforms.) You see a listing of the most popular software available for download and installation.
  2. Select Developer Tools (or Development) from the All Software dropdown list box. You see a listing of developer tools, including Python.
  3. Double-click the Python 3.11.2 entry. The Ubuntu Software Center provides details about the Python 3.11.2 entry and offers to install it for you
  4. Click Install. Ubuntu begins the process of installing Python. A progress bar shows the download and installation status. When the installation is complete, the Install button changes to a Remove button
  5. Following the above steps will have Python installed on your Linux machine.

The Graphical installation Guide is  well covered  in a book named Beginning Programming with Python for DUMMIES ( by  A Wiley Brand).