Before we start writing python code and run it, we need something called interpreter installed in our system. Interpreter is a piece of software which actually converts code to low level machine code and executes line by line. Like other software, it’s also platform dependent (Not python code but its interpreter). There are several ways to install python in your machine.

  • Downloading appropriate installer from python org and running it.
  • Using Package-manager (Mostly in Linux distro).
  • If you like doing things in hard way. You can download source code, prepare build environment and compile it on your own.

I am going to explain first two in this post. You can try third one using this link. Lets see how to install python on windows, linux and mac os.

  • Python3 in Windows
  • Python3 in Linux
  • python3 in Mac OS

Installing Python 3 on Windows

Step 1: Download installer for windows from here.

32-bit vs 64-bit?

While choosing an installer you can go with one depending upon your CPU architecture and windows version. If you have 64-bit processor or 64-bit windows in your system either of them works fine but it is recommended to use 64-bit version of python for better performance. Otherwise you have to download 32-bit version. You can find out which architecture/windows using this link.

Step 2: Run the installer.

Once you have chosen and downloaded an installer, you can double click and run it. After which window like this will appear.


You might want to tick on that “Add Python 3.x To PATH” box. Unless you want to specify the path of python interpreter every time you run your code. After you click on “Install Now”, your are good to go. To verify your installation you can type following command in cmd.

This will give output.

Installing Python 3 On Linux

Some Linux distribution already have python installed in it. you can verify it by using the commands

  • python –version
  • python2 –version
  • python3 –version

Depending upon output from above commands, you could find whether there is python already installed in your system or not. Some old Linux distribution comes with only python2 installed or older version of python3. Here are few steps for installing python3 in Ubuntu distribution.

  • For Ubuntu 16.10 and higher Open terminal and enter following command.
  • For Ubuntu 14.04 or 16.04 python3.7 is not available in universe repository so we are going to install it via third party PPA.

After installation you can verify it by using command

Installing Python 3 On Mac OS

Currently Mac OS is equipped with little older version of python2. As we are trying to stick with python3, python2 is of no use for us. So, lets get it installed.

Even though we can install Python by downloading package from official Python site, Its recommended to use package manager like Homebrew to manage all of your dependencies in long run.

Step 1:Install Xcode and Homebrew

As Homebrew depends on a Apple’s Xcode package, first we need to install package using following command.

After confirmations and completion of installation, run following command (from Homebrew official website) to install Homebrew .

To confirm Homebrew installed correctly, run this command:

Step2: Install python

Install latest version of python3 using command:

And confirm installation by:

Finally, After all these set up its time to do some code but wait where are we going to write our code? Well you can write python code with python shell or notepad or nano if you don’t mind counting spaces and tabs or you can choose any IDE/code editor. IDE stands for integrated development environment. In simple terms, Its software with different tools that makes developers life easier by giving sort of platform to code/ debug and test the application. There are many IDEs and code editor available for development and testing purpose, paid as well as free. BUT WHICH ONE???

Choosing An IDE??

Aww , Here we go again. Politics of IDE. If you have personnel preference over any IDE or code editor then you can skip this whole section and go into coding section of this post. But if you are an absolute beginner then let me tell you some secret that No one is ever going to tell you. “IDES or most accurately code editors are like ice-cream flavors–purely personnel taste “. Personally, I prefer PyCharm over other IDE for python but again its just my choice. You can go with any code editor or IDE like Sublime Text, Atom, VS Code, Notepad++, Spyder etc.

Hello World In Python.

Python is an interpreted language means code is executed line by line. Python provides Python shell or Python interactive shell to execute one single Python command and get output. we will start with Python shell to do hello world program.

To start Python shell we need to open console, type ‘python’ and enter. This will give contextual information like this and cursor will start blinking near ‘>>>’. this triple ‘greater than sign’ means we are now inside python shell rather than normal shell.

Now type following command to print hello world.

It’s nearly impossible to write 100s of line of code in shell and test it properly so we are going to write our code in file and run it. Lets see how we can do that.

Generally files with extension .py, .pyc, .pyo, .pyd are python associated file. Among these, only .py is a file containing source code also called as Python script and others are file generated by interpreter. Here the conclusion is we write our code in editor and save it as <file-name>.py.

Now open editor and write this command.

Save this file as “”. To run this script we have to open console and use command.

Like this.


To run other Python Script,it’s pretty much same process. In our next post we will learn about variables and input output in python.