How to Install Python

how to install python banner
Installing Python on your computer and coding your first program in Python is very simple. This article overviews the steps.

Share This Post

Python is one of the most popular programming languages in the world. Installing Python on your computer and writing your first program is fairly simple. This article overviews the steps.  

Installing the Python Interpreter

In computer science, an interpreter is a computer program that executes instructions in a specific programming language. The Python interpreter takes the code written in Python, compiles it into Python’s byte code, and executes the Python byte code on a virtual machine. Python’s byte code (similar to Java byte code and many other programming languages that use a virtual machine) is very similar to machine code. However, unlike machine code, it doesn’t run directly on the computer. It runs on a virtual computer created using a virtual machine. The Python interpreter includes the required utilities for developing and running code in Python, and includes the virtual machine itself.

The first step would be downloading and installing the Python interpreter. You can find it available for free download at https://www.python.org/downloads. Make sure you download the version that is suitable for your computer operating system. 

installing python page banner

Once the download completes, just double click it and goes through the steps. Make sure you accept the license agreement and provide the required access the installer asks. 

Installing Integrated Development Environment

Once the Python interpreter is installed we can start writing our code in Python using a simple text editor and use the python utility for executing our program. However, doing so requires us to use the terminal. Most people are not familiar with the terminal, and many others don’t find it comfortable. For that reason, our advice is to install an integrated development environment (IDE). One popular option is PyCharm. Another popular option is VS Code. These are the two most popular Python IDEs. Based on my experience teaching Python programming, I find the PyCharm IDE more friendly. You can download the community free version of PyCharm at https://www.jetbrains.com/pycharm/download.

PyCharm Community Free Version Banner

Once the download completes, double-click the downloaded file and go through the installation steps. Assuming the Python interpreter was already installed, the installation process of PyCharm will identify the location of the Python interpreter and will configure PyCharm accordingly. 

Writing The First Program in Python

In order to verify that Python was installed correctly we should code a simple program and execute it. When executing PyCharm for the first time, most likely that you will get a screen that doesn’t show previous projects. 

PyCharm hOW to install python banner

The next step would be pressing the ‘New Project’ button and fill in the details of the new project you want to create. You can specify the name of the project and its location. You can also specify that you want to create a new environment using the virtualenv utility. This is the window in which you can also specify the Python interpreter you want the new project to use. Most likely that you will see the Python interpreter you have just installed. You can specify that you want a main.py file to be created. Files with the ‘py’ extension are files that include code in Python. 

how to install python new project pycharm

The next step would be to execute the code in Python you can find in the main.py file. Just open the main.py file, right-click with your mouse pointing at the tab window where main.py is opened, and select Run ‘main’ from the opened context menu. 

showing how to select run main from the context menu - banner

You will get to see the code running and you will get to see its output shown on the bottom of the window. 

showing how to select run main from the context menu - banner

In line #7 you can find a definition for a function. We define a function using the def keyword. It is a function that takes a string and prints it to the console. The print function (in line #9) prints to the console whatever is passed over.  The if statement (in line #13) just verifies that the code in this file is executed directly and not indirectly due to import another module does to this file. 

If you are new to programming, you can write another simple program, that includes one single line that prints hello to the screen, and execute it the way we have just explained. 

Python hello Banner

If you want to learn Python we recommend you to check out our Introduction to Programming with Python online course on Udemy. It was developed in English. If you happen to know Hebrew, check out our תכנות בפייתון course at life michael academy, and our premium course Python Programming. In addition, we recommend you to check out our other Python related courses and seminars

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Java Catching Up
Java

Java’s Most Recent Updates

During the last decade, the Java programming language continued to evolve. We can assist you catching up with these new features.

OpenAI API Course
Artificial Intelligence

Using The OpenAI API

OpenAI provides us with API we can use in order to add AI capabilities to the software we develop. Join our course and learn how to do it.

Do You Want To Boost Your Business?

drop us a line and keep in touch

life michael academy asynchronous online courses

Java | Python | JavaScript | TypeScript

Skip to content Update cookies preferences