Install Python on Windows, Mac and on Linux

In previous articles we have studied about Python Introduction and the difference between Python 2 and version 3. In this guide we’ll install Python interpreter on Windows, mac and on Linux platform and execute a simple example to verify it.

As you already know Python is a High-Level interpreted language with higher code readability closer to English. To run any python program, we need Python interpreter installed on our platform. Python has two major version 2 and 3, there is small difference between them which you can study here.

Note: You can also use online python interpreter like PythonShell or codechef etc.

How to Install Python 3 on Windows Platform?

1. Download Python from Here. Download directly available version or select among 32 bit or 64 bit based on your system requirement.

install python on Win 1

2. Double-click on downloaded file and click on RUN to start installation process.

3. ON pop-up window change installation directory if you want or just check ‘ADD Python 3.7 to PATH’ in below options and click on Install Now.

install python on windows_2

4. Wait for minute for installation to complete and then click Close.

install python on Win 3
install python on Win 4

5. If you forget to check ‘ADD python 3.7 to PATH’, follow instructions mentioned here to add file path (C:\Users\USERNAMEXX\AppData\Local\Programs\Python\Python37-32) to Environment variable.

install python on Win 5

6. To verify python version installed. Open command prompt and type python –version or just python or you can also check by IDLE shell installed by python. Click on start>> type python and open IDLE (Python 3.7 32bit).

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) 
[MSC v.1915 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
C:\Users\XXXX>python --version
Python 3.7.1

install python on Win 6

Example using both CMD and Python shell:


1. Copy below program to notepad and save it with extension. I saved file on desktop folder python.


2. Open Command prompt and type below commands.

C:\Users\XXXX>cd desktop/python



Python Shell:

1. Open IDLE (Python 3.7 32bit) and enter below line of code and hit enter.


How to Install Python 3 on Mac OS X?

Mac comes with Python 2.7.x preinstalled on it. You can check it by typing python or python --version command on terminal.

yourmacxxx: ~username$ python
Python 2.7.15 (default, Jun 17 2018, 12:46:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
yourmacxxx: ~username$ python --version
Python 2.7.15

To install Python 3.7.x follow below instructions.

1. Visit Link and download python.

install python on mac

2. Open the downloaded file, an installation process starts. Change directory if you want or leave it to default.  Click three times continue.

install python on mac 2

3. Agree to terms of license and click Install.

install python on mac 3

4. Enter password and click on Install Software. Wait for installation to complete than click on close.

install python on mac 4

5. To verify open terminal and enter python3 or python3 –-version.

yourmacxxx: ~username$ python3 --version
Python 3.7.0
yourmacxxx: ~username$ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Try an Example:

1. Open TextEdit and copy below line and save it as on desktop.


2. Now enter following command on terminal

yourmacxxx:~ username$ cd desktop
yourmacxxx: Desktop username$ python

How to Install Python 3 on Linux?

Use following command to install prerequisites for Python before installing it. Linux comes with 2.x version preinstalled.

User@ubuntuxx:~$ sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

1. Download File using following command from python official site.

cd /usr/src
sudo wget

2. Now extract the package with commands.

sudo tar xzf Python-3.7.0.tgz

3. Compile python source code using altinstall. Command altinstall used to prevent replacing the default python binary file /usr/bin/python.

cd Python-3.7.1
sudo ./configure --enable-optimizations
sudo make altinstall

4. To verify latest version use below command.

User@ubuntuxx:~$ python3.7 -V


Try an Example

1. Open a new document and copy below code save to desktop with .py extension (ex.


2. Now again open Terminal enter following commands.

user@ubuntuxx: ~$ cd Desktop
user@ubuntuxx: ~/Desktop$ python

We have completed our tutorial on how to install python on windows, Linux, Mac and also executed a simple example. Next tutorials will be installing required Python IDE’s and their configuration for larger programs.

Leave your feedback and questions in comment section.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *