Post

Installation of Python

In this part, we will learn to set up python on our computer, and once we do that, we will be ready to run our first python program.

Installation of Python

Python is available mainly on various platforms like Linux, Windows, Mac OS X, and embedded systems like Raspberry Pi.

So let’s set up python on our Computers.

How to install Python on Windows

Step 1: To check if you have python installed on your Windows PC, we have to run Command prompt(cmd.exe) on Run Menu, which can be open Crlt + R.

Step 3: After opening the cmd, we will type the following command to check if you have python installed.

1
C:\\Users\\Your Name > python --version

Output:

1
Python 3.9.1

How to install Python on Windows computers

Step 1: To install python on windows, first, we have to download python from their official website: http://www.python.org/downloads and then click on Download Python. Maybe you will see a different python version, but you can download any newer version from 3.9.

Step 2: Open the python file we downloaded. Suppose it asks for administrator permission press Yes.

Step 3: Select the checkbox “Add Python 3.9 to PATH” option. You are free not to select it, but it may cause an issue in the future if you do not check it. Python community recommended it to select the checkbox.

Step 4: Now click on Install Now, and if it asks for Administrator permission, press the Yes button, and then python will start installing on your computer.

Step 5: You will see a message like “Setup was successful,” which means we have installed python on our Windows computer, then click on the Close button to close the python setup file.

How to install python on Linux

To check if python is installed on your Linux pc, we have to follow the same steps as above. Still, instead of opening CMD, we will open a terminal in Linux by pressing Alt + Clt + T on your keyboard, and in the terminal, type the following commands to check the python version.

1
python --version

The easiest way to run python:

The easiest and secure way to run python code is by using python IDLE.
Python IDLE is the official text editor provided by python. It is available along with python on windows platforms, but we need to install it separately on Linux.

Let’s install python and Python idle on the windows platform step by step. If python is not installed on your Windows computer, follow these steps.

It is straightforward to install python on a Linux computer; unlike windows, it has very few steps.

Step 1: Type the following command in the Linux terminal

1
sudo apt install python3

As you see, python is already installed on my Linux computer.

But if python is not installed on your computer, you will see something like this.

If it asks for a password, type it and hit enter. Then you will see something like this.

Now press Yes or just hint enter, and python3 will be installed on your computer.

How to run python on Linux?

Now let install python idle using the following command.

1
sudo apt install idle

And follow the same process to install idle.

We have to search idle the same for Linux and windows by searching Idle on the start bar on windows and search bar in Linux to open idle.

To open idle on your computer, you can search “idle” on your respected operating system.

Below you can see the First look of Python IDLE.

1
(First look of Python Idle)

Online Python Compiler / Interpreter

If you don’t want the hustle of installing python and other software on your computer, you can use our online python compiler/interpreter. It can run python code very smoothly. It is very easy to use for beginners, and if you don’t have a computer, you can also run it on your mobile phone through web browsers like Google Chrome or other web browsers.

Jupyter Notebook

The Jupyter Notebook is an open-source web IDE that allows you to create and share documents that contain live Python code, equations, visualizations, and narrative text. It is mainly used by beginners using python for data science because it provides a beautiful interface.

Install Jupyter Notebook on Linux

Same as python idle, we can install Jupyter notebook with the same steps as follow.

1
sudo apt install jupyter

To open Jupyter notebook, we have to type jupyter notebook on the Linux terminal.

Install Jupyter Notebook on Windows

If you want to install a jupyter notebook on windows, we have to follow the same steps as installing python on a windows computer. Still, like Linux, we cannot install jupyter notebook on windows directly; it comes with Anaconda software, which is a powerful tool for learning Data Science, Machine learning, and Artificial intelligence.

We can also install anaconda in Linux as well as on Mac OS.

We can download anaconda from its official website. To download anaconda, click here. (link:https://www.anaconda.com/products/individual)

Pycharm

Pycharm is the most popular and most used integrated development environment (IDE) used by most experienced developers. Pycharm has a Professional version that is not free, and a community version is a free community version giving the project name; click on creating a new pycharm project.

Pycharm will make a separate virtual environment for all the projects, which can be used to work with different versions of python libraries without affecting your system libraries.

There is a very different method to install Pycharm in Linux, and for Windows, it is the same steps to follow, just like we install python.

If any student with an academic email, which will be examplename@universityname.edu, can request to access the pycharm professional edition for free. For more information, vistheirere Educational Page.

Install Pycharm on Linux

To install pycharm on a Linux computer, we have to open the terminal and type the following command in the terminal.

1
sudo snap install pycharm-community --classic 

The second method to install pycharm on a Linux computer is by downloading the pycharm package manually, which will be a tar.gz file.

Step 1: Go to the Pycharm Download page(link) and download the Community version.

Step 2: Go to the path where you have downloaded the Pycharm file.

1
2
cd /Downloads

Step 3: Now, we have to extract the tar.gz file using the tar command.

1
tar -xzf pycharm-community-2020.3.2.3.2.tar.gz

Step 4: Now go to the extracted pycharm folder as follows.

1
cd pycharm-community-2020.3.2

Step 5: Now go to its bin folder inside the pycharm folder.

1
cd bin

Step 6: We have to make sure that the pycharm shell script has sufficient permission:

1
chmod u+x pycharm.sh

Step 7: Now run the shell script.

1
bash pycharm.sh

Pycharm IDE interface

There are many different kinds of IDE’s and interpreters which are used to compile and execute the python codes like Atom, Scite, and Spyder.

But if you’re a beginner python, IDLE and a jupyter notebook will be easier to run python code and your experience coder; you can go for pycharm or Atom. These IDEs will save more time than any other IDE’s for python.

How to install python modules?

In this step, we will learn about how we can install python modules on you system but let us first know what is python modules.

What is a python module?

The python module is just a bunch of python files (.py) that contains codes and statement that can be used to import into an existing program to add functionality without writing large codes.
Python modules are also known as python packages and python libraries.

How to install the python module or python library?

We can use the “pip” command to install the python modules in our python environments.

Example 1:

1
pip install Module_Name

Example 2:

1
python -m pip install Module_Name

Tips for beginners

  • Always use a simple interpreter to execute python codes.
  • Use Python3 newer version because mostly python2 comes preinstalled in many operating systems, but python2 is outdated.
  • Always make a separate virtual environment while working with pycharm.
  • Never Uninstall pre-install Python, which comes with many Operating systems; it is meant to crash your operating system.

FAQs

How to check if python is installed on Linux?

We can use the built-in python command to check if python is installed on Linux or on Ubuntu. Use the below command to check whether python is installed or not.

1
python -V

If python is installed then it will print the installed version of python or it will return an error.

how to check if python is installed in Linux?
We can use the built-in python command to check if python is installed on Linux or on Ubuntu. Use the below command to check whether python is installed or not.

1
python -V

If python is installed then it will print the installed version of python or it will return an error.

how to check if python is installed on windows?

We can use the below command to check if python is installed or not on your windows system.

1
python -V

What is pip install python?

The pip stands for Package installer for python that’s is a free package manager tool to install python packages or python libraries in your python environment.

This post is licensed under CC BY 4.0 by the author.