1. Home
  2. Docs
  3. Python 101 – Python Programming for Beginners
  4. Python installation

Python installation

Python Installation

This section covers python installation procedure for windows and Linux.

Python program installers are available for most operating systems at  www.python.org

 

Python 2 or Python 3 ? Which one to use ?

 

Python comes with two versions, python 3.6.x and python 2.7.x, commonly referred  as python 3 and python 2.

And both versions are different and not backward compatible.

Python installation, download python from python.org site
python installer download

There is a lot of debate on which version to be used.

But for simplicity just start with Python 3.

As  Python 2.7.x  is current, and Python 3.6.x is future.

Python 2 is going to reach the end of its life in 2020,

there will be no 2.8.x or new features added to 2.7.x

on the other hand,  Python 3. has lot of improvements, new features, and some nice new tricks.

On the downside, even though Python 3 was released in December 2008, there are still adoption problems.

And many of the packages and modules are not yet ported form 2.x.x to 3.x.x.

There are not that many differences between Python 2 and Python 3, from syntax point of view.

Most of the changes are about how things work differently under the hood.

 

Python 3 installation

Python for Windows

1.  Down load python 3.6.x version from https://www.python.org/downloads/ site,

2. Check the download folder, for python-3.6.3.exe

3. Click on the python-3.6.3.exe to launch installer

4. Check the Add Python 3.6 to PATH. You can also add python path later at

My Computer > Properties > Advanced System Settings > Environment Variables > System Variable->path

5.  Click install now

6. After installation, check the path of the installation.

7.  It will be usually at C:\Users\(Your logged in User)\AppData\Local\Programs\Python\Python36-32

8. Run cmd or power shell, and type python –version

C:\Users\PC-USER>python --version

Python 2.7.13

Above output says Python 2.7.13 version available, Why ?

By default python points to python 2.7.x version and 

it is possible to have multiple Python versions on same PC, in order to access python 3 go to

C:\Users\(Your logged in User)\AppData\Local\Programs\Python\Python36-32

and rename python.exe to python3.exe, close and reopen CMD shell  and type

C:\Users\PC-USER>python3 --version
Python 3.6.3

After installation complete, on your system you have

  1. Python interactive Shell, and
  2. IDLE IDE.

Python interactive shell is a CLI tool and is a  REPL

Read->evaluate->print->loop->Read

it Reads user input, Evaluates the commands, Prints the output and Loops back to read user input.

IDLE IDE is default IDE (Integrated Development Environment), which comes with standard Python installation.

 

Python for Linux

Many of the Unix/Linux distribution have Python 2.7.x  pre installed. and some have Python 3.x.x also.

To check, which version of Python available on your system.

Open shell and  type

python --version

You will get Python version printed on your screen.

Output:

Python 2.7.13

 

If Python 2.x.x version installed or no Python installed.

You run bellow command on shell prompt. Which installs Python 3.

sudo apt-get install python3