Python Installation

python_on_pc

Python is a general-purpose, high-level, cross-platform programming language developed in 1991 by Guido Van Rossum. It is freely available at https://www.python.org/downloads/ source code of python is also available hence, it is an open-source project. anyone or everyone can download and use python. In this tutorial, we will be installing python3 on different operating systems.

How to install Python3(Environment Setup)

In this section we will learn how to install python on different operating systems:-

Installation on Windows

To download the latest version of Python visit this link https://www.python.org/downloads/ . Click on the requied version to download it.

download_page

Double-click the executable file which is downloaded; the following window will open. Select Customize installation and proceed.

install_start

The following window shows all the optional features. All the features need to be installed and are checked by default; we need to click next to continue.

step2

The following window shows a list of advanced options. Check all the options which you want to install and click next. Here, we must notice that the first check-box (install for all users) must be checked.

step3

Now, we are ready to install python-3.6.7. Let’s install it.

step4

Now, try to run python on the command prompt. Type the command python in case of python2 or python3 in case of python3. It will show an error as given in the below image. It is because we haven’t set the path.

cmd1

To set the path of python, we need to the right click on “my computer” and go to Properties → Advanced → Environment Variables.

step5
step6

Add the new path variable in the user variable section.

step7

Type PATH as the variable name and set the path to the installation directory of the python shown in the below image.

step8

Now, the path is set, we are ready to run python on our local system. Restart CMD, and type python again. It will open the python interpreter shell where we can execute the python statements.

Installation on macOS

Python comes pre installed on macOS . we can check the currently installed version by typing “python -version” in the terminal app.

mac1

It shows Python 2.7.10 is currently installed. Now, let download and install Python3.

In order to install Python3, we must download the latest version from its official website https://www.python.org/downloads/. The downloaded file with .pkg format can be directly installed by using Installer command.

Let’s see how can we do it.

mac2

The installer uses superuser permissions hence sudo forces terminal to prompt the user to fill the admin password. The process installs the Python 3.6.3 to the root directory mentioned with the target option.

To check which Python version is installed on the machine, we can use python -version command. Since the default installed version is Python 2.7.10 hence it shows python 2.7.10. but it gives us the flexibility to check the version of Python 3 on our computer. So, we can check the installed version of python 3 by using python3 -version.

Installation on Linux(Ubuntu)

In this section, we are looking at the installation process of python on linux systems.

Although the default version of python on ubuntu is Python 2.7, but we can in stall other versions of Python like python 3. In order to install python 3, just type the following commands in the terminal and it will be installed automatically.

Updating the APT Repository

apt-get update

Install Python

apt-get install python3.6

Verify Python

When we type python3 it shows the installed version of python3.

python3

Conclusion

As we know that python is a cross-platform programming language and used to develop different applications on different platforms. In order to start developing different apps, first of all, we need to install python on our system. In this tutorial, we have seen the process of installing python on windows, mac, and Linux. Although python comes pre-installed on Linux and macOS but to get the latest version we need to use some commands. However, in windows python needs to be download and install.

To check the current installed version of python use command “python -version” in your cmd or terminal. Now that we have installed python3 on our PC let’s start using it by simply typing python3 in terminal.