Installing Python on your System

Installing Python on your System
Photo by Gabriel Heinzer / Unsplash

To install and run Python on our local machine i.e your computer, we need to install the Python interpreter.

What is a compiler?

A compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). The name compiler is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program. - Wiki

Assuming Alice and Bob speak two different languages and are using a compiler to communicate.One can imagine having the entire transcript of Alice's speech available to us before she speaks. Thus we can translate all of it before relaying the message to Bob. It also helps to weed out errors before the execution of the program.  For example, C and C++ are compiled languages.

What is an Interpreter?

In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.  - Wiki

Assuming Alice and Bob speak two different languages and are using an interpreter to communicate. One can imagine an interpreter communicating the meaning of what Alice is trying to say to Bob as Alice is speaking.
Interpreters help communicate certain high-level instructions to the processor as they are being run.

Installing Python on your system:

If you are using a Unix based Operating System, in your terminal or on your command shell in Windows, type:
python  --version

You will most likely see the preinstalled version of your python interpreter. For following the lesson series it is highly recommended that you use Python3 and above versions as Python2 support has ended which in general terms means that the programming world has moved on to Python3 as the accepted standard which has richer features than Python2.
You can install the newest version from the downloads link https://www.python.org/downloads/.



Go through the installation wizard and follow the default installation setup.



After installation check your installation by
typing on your terminal/cmd shell:
python3
This will lead to a python shell where you can type and run python commands.
Try typing:
print("hello world!")
and hit return.
Woah! You just ran your first line of Python code on your local machine.
Type the following to exit the shell:

exit()

Note: You have not changed the default version of your python interpreter yet. You may want to refer to other resources if you absolutely need to do it. Although it's not required for this series of lessons.

Your default installation of the python package comes with a code editor called IDLE which you may use for a visually pleasing coding experience. It helps order your packages more easily as your codebase expands. For this series of blogs you can use the editor available here on your browser, terminal or IDLE whichever is more comfortable for you.