How to Install and Getting Started With Python
A Beginner’s Guide and for anyone who wants to start learning Python
Python is one of the fastest-growing programming languages nowadays and is used for machine learning, data science, and a lot of other use cases. The best way to start learning python is by practicing it on your machine.
We need to install python on your machine first. Once installed, you can run the python code on your machine. In this post, Let’s see how we can install python and run python code.
- Installation On Windows
- Installation On Mac Os
- Installation On Linux
- How to run python code
- What are PIP and Virtualenv
- Summary
- Conclusion
Installation On Windows
Sometimes your laptop may come with python installed and you can check by opening a command prompt and do python -V. If you are seeing the below error, it means python is not installed on your machine and you can continue with this tutorial.

There are two versions of python out there 3.7(latest) and 2.7. Let’s go to this page and download the version that you want.

You can download any version But, most of the recent python apps are on python 3 and python 2 support is ending soon. For those reasons, let’s download python 3. Once you click on that link and you will be redirected to the below page and download the executable depending on your machine.

When you double click on this, a popup window is shown like below

You can check the second checkbox Add Python 3.7 to PATH so that you can use it directly without any path specified. Once you click on the Install Now and you will see the following screens.


Now we can check the python version by opening a command-line interface. Make sure you are checking with capital V.

Installation On Mac Os
Installing python on Mac OS is no different than above. Let’s go to this page and download the macOS 64-bit installer.

Once you download the installer, double click on it and follow the instructions like below.


Now we can check the python version by opening a terminal. Make sure you are checking with capital V.
One thing we can notice on Mac OS is that there are two versions installed: one is 2.7.15 and another one is 3.7.4. You can check and run those with the commands python2 and python3 respectively.

Installation On Linux
There are so many Linux distributions out there. The following commands are for Ubuntu. Once installed you can verify the installation as same as above.
sudo apt-get update
sudo apt-get install python3.7How to run python code
There are a couple of ways to run the python code: one is to use python interpreter and another one is to run the python file which ends with .py extension. Let’s see both ways below.
- Python Interpreter
- With .py extension files
Python Interpreter
python interpreter comes with the python installation and all you need to type python in the command-line interface or terminal to use it. If you want to exit, just type exit().

With .py extension files
I have put the same code in the fruits.py file and run this python fruits.py in the visual studio code. Here is the output.


So, once python is installed there are two ways we can run and practice your python code.
What are PIP and Virtualenv
Besides this actual installation of python, these two tools PIP and Virtualenv are essential for python development.
PIP
The pip package is the most popular way to install, upgrade, and remove third-party libraries. pip doesn’t usually come with standard python installation and we have to install pip separately. But, from python 3.4 version, pip is a part of the standard installation.
If you want to install pip3 on your machine, here are the commands
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.pyNow we can check the version of pip3 with this command pip3 -V

It’s a tool to install python packages from the Python Package Index(PyPi). PyPi is the central repository for all the open-source and third-party python packages. Let’s see some of the examples
numpy is one of the useful packages and you can install that package with the pip pip install numpy. Here is an example of how to use that package.












