Python

Getting started

Python 3.8

We will use python 3.8. Support for python2 has been stopped. No new bug reports, fixes, or changes will be made to Python 2. In python 3.9 is in its beta testing phase

Choosing the OS

Windows

Get the Source file from https://www.python.org/downloads/release/python-380/ .

Fig 1. Choose the Windows installer file

Run the downloaded file python-3.8.x. Before clicking Install Now, check Add Python 3.8 to Path option. This will help OS find the path to python interpreter.

Fig 2. Python installer prompt

To make sure the path is updated go to This PC->System Properties->Advanced System Settings (Advanced Tab)->Environment variables and make sure Path is added and is pointing to the python interpreter.

Fig 3. System Properties
Fig 4. Advanced System Settings
Fig 5. Environment variables

Ubuntu (or any other debian based OS)

Ubuntu has its own package manage, aptitude. You can install python from apt. You will need sudo to let apt to download and install any packages. So, make sure you are a super user. Most of the Linux operating systems come pre installed with Python. To make sure python is installed and you have the correct version run the following command

# returns which python interpreter is used
$ which python3

# check the python version
$ python3 --version
Fig 6. Check if python is installed

If your python is not 3.8.x run the following commands

# download latest package information from all configured sources
$ sudo apt update

# download and install dependencies for python
$ sudo apt -y install software-properties-common build-essential libssl-dev libffi-dev python3-dev python3-pip python3-venv

MacOs

First install homebrew on Mac which allows you to install any Linux package on mac. Then install python using brew

# Run this to install homebrew
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# To install python using brew run the following command
$ brew install python3

Confirming python3.8 is installed

Open a terminal and type the following commands to confirm python is installed, check which one works for you. If everything went right you must be able to open a python interpreter

# 1.
$ python

# 2.
$ python3
Fig 7. Confirm python is installed
Fig 8. Confirm python is installed

Use exit function to exit from the python interpreter

>>> exit()