Start with python | Installation On Windows and Linux.

Now we know some basics about the python programming language.   In this tutorial, we will start with basic practical python learning.  The tutorial is designed in such a way that even a person with no programming knowledge can also start learning.

The first step is to install and set up a programming environment. In this tutorial, you will learn how to set up the environment on Windows and Linux operating systems. On Windows, the whole process is GUI-based while on Linux there is a command-line interface.

You can download python from here.

How to Install and use Python on Windows?

Installation of python on Windows
Start python installation on Windows.

You need to download the python installer first and save it. After double click on the installer, you will see the screen on right. It has two options one is installed now and another is for customized installation.  The first option is for the default installation option and installation path. While if you use another option you can customize packages and the installation path. But for simplicity, we will click on the Install now option.

After a successful installation, you will see the below screen. To start the python console you need to type python in the start search box and click on python.

Python Installation on Windows success.
Python console

The black console appears in the interactive programming environment.  Here you can write the python code and execute it. For example, if you want to add two numbers, print Hello World, etc.

Adding two numbers example –  Type 3 +5 after >>> and enter you will see the output 8. Here 3 and 5 are the operands and + is an operator.

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 3+ 5

Print “Hello World” using the print function.

>>> print("Hello World")
Hello World

How to run a python program from a file?

Till now we have successfully executed a few lines of code in interactive mode. Where we write code on prompt and get output.  But this is not the case with real software development.  The programmer writes instructions in a file and passes them to the interpreter as input.

Let’s write the print(“Hello World”)  in a text file using a text editor and save the file with the .py extension.  In our example the file name is To run, on cmd type “py FileLocation/

D:\Python Examples>py
Hello World

D:\Python Examples>

Alternatively, you can also use an IDE for software development.

How to Install on Linux?

Linux is another popular operating system.  It is mainly used to deploy heavy applications on servers.  For demonstration, we are using Linux CentOs7 with 64 bits.  The Linux machine is connected to the internet. Because of that, we can install any package or rpm using yum.   All operations will be using the console by doing ssh to the machine using putty.

Check if Python is installed?

# python --version
Python 2.7.5

Yes, we have already installed python. If not so do not worry you can use the following command to install python.

# sudo yum install python

Create a file using the VIM editor. Write line print(“Hello World – Linux”); . Save and close the file.   The execution is following.

# python
Hello World - Linux

Conclusion :

We have learned how to set up the basic python environment to start programming.  There could other packages are needed while working with python e.g setuptools and PIP

These we will cover in another tutorial with details. Here covering may make it more complex to understand.