Jan Brinkmann
By Jan Brinkmann Last updated on Shown in: Python 3.6

Imagine starting a programming project for the first time and having your first program running after just a few minutes. That is exactly where this guide will take you. On Windows, you basically only need two tools: an interpreter that runs your Python code, and an editor in which you write the code. You will set up both in just a few steps.

Programming with Python - 1.2 Using Python under Windows

The video is only loaded from YouTube when you play it – data (including your IP address) is then transmitted to YouTube/Google. More in the privacy policy

I will show you where to download the interpreter, what to look out for during installation, and why a small checkmark during installation is so important. Afterwards, you will check in the Command Prompt whether everything works. Then you will install the PyCharm development environment and create your first project.

Key takeaways

  • You need Python in two parts: the interpreter, which runs the code, and an editor or development environment for writing the code.
  • You download the interpreter exclusively from the official project website python.org.
  • The option "Add python.exe to PATH" ensures that the python command works in the Command Prompt. Be sure to enable it.
  • With the python command in the Command Prompt and a short output, you check whether the installation was successful.
  • PyCharm Community Edition is free and is excellent for getting started.
  • With a right-click on the project you create a new Python file, and with the key combination Alt+Shift+F10 you run it.

Step 1: Download the Python interpreter

The first step takes you to the official homepage python.org. There you will find not only current information about the language but also the downloads for all common operating systems. Since you are working on Windows, you choose the Windows version. It is best to download the latest stable version, because it contains the current features and security updates.

Installing Python on Windows: A Beginner's Guide

Step 2: Start the installer and choose the right options

After the download, you open the downloaded file. For security, Windows may ask once more whether you want to allow the installation. Confirm this. Then a selection dialog with two installation types appears.

The standard installation is entirely sufficient for beginners, because it contains nearly all the important components. So select it. What is absolutely crucial, however, is the checkmark at the bottom of the window next to the option "Add python.exe to PATH". Be sure to set it before you click "Install Now". If you overlook it, you will get an error message later during the test in the Command Prompt.

Installing Python on Windows: A Beginner's Guide

Step 3: Understand the PATH variable

Perhaps you are not yet familiar with the term PATH if you have little experience with Windows or the command line. Basically, it is an environment variable. It is a list of directories in which Windows searches for programs when you enter a command. If the Python folder is in this list, Windows recognizes the python command anywhere in the Command Prompt.

That is exactly why the checkmark from the last step is so important. Without it, you would have to enter the path to Python manually later, which is cumbersome and error-prone. With the checkmark, the installer does this automatically for you.

Step 4: Remove the 260-character limit

On some Windows systems, a notice about a 260-character limit for file paths appears during or after the installation. This limit comes from an older Windows configuration. Since long paths can occur in Python projects, it makes sense to remove the limit. If the installer offers you a button for this, simply click it and confirm the change. This also reliably solves the problem with the PATH variable.

Step 5: Complete the installation

Now click "Install Now". The installation takes only a short moment. Once it is complete, the installer reports success. You can then close the window. The interpreter is now on your system.

Step 6: Test the installation in the Command Prompt

Now you check whether everything works. To do this, open the Command Prompt by typing cmd in the Windows search and starting the application. Then type python and confirm with the Enter key.

If the installation worked, the version information of Python appears along with the prompt >>>. This means that the interpreter is ready. Now test a small command: Enter print("Mein Name ist ...") with your own name. If the output appears, the interpreter is working perfectly. With quit() you exit the Python environment again. You have thus successfully completed the first part.

Installing Python on Windows: A Beginner's Guide

Step 7: Download PyCharm

For actual programming, you need more than a simple text editor. A development environment like PyCharm offers you code completion, error hints, project management, and convenient ways to run your programs. PyCharm comes from JetBrains, a software company whose development environments have a very good reputation in the industry. IntelliJ IDEA and PhpStorm also come from this manufacturer.

Open jetbrains.com in your browser and select the IDEs section there. Then look for PyCharm. The Community Edition is free and can be used for an unlimited time. It is completely sufficient for getting started. Download the installation file. It is about 180 MB in size.

Installing Python on Windows: A Beginner's Guide

Step 8: Install PyCharm and Pay Attention to the File Association

Run the downloaded file. The installation wizard guides you through the individual steps. For most settings, you can accept the defaults.

However, pay attention to the option to associate files with the extension .py with PyCharm. I would not recommend this association. The reason is simple: with the default association to Python, you can run a script directly by double-clicking it in Windows Explorer. If the files are associated with PyCharm instead, a double-click only opens the editor. So leave out the association so that double-clicking still starts the script.

Installing Python on Windows: A Beginner's Guide

Step 9: Create the First Project in PyCharm

Start PyCharm via the desktop icon or the Start menu. After the splash screen, the welcome screen appears. Select the option for a new project there.

PyCharm automatically suggests an interpreter to you. Make sure that the Python version you just installed appears there. Then give the project a name, for example "Hallo Welt". This name will be created as a directory. For your later exercises, it is best to create a shared folder in which all course projects are stored. That way you can quickly find earlier examples again later. Confirm with "Create".

A side tip: on startup, PyCharm often displays small tips. Take a minute or two to click through them instead of closing them right away. You will learn many useful features along the way.

Installing Python on Windows: A Beginner's Guide

Step 10: Create a Python File and Write the Code

Now create a new file in the project. To do so, right-click on the project and select "New" and then "Python File". Again enter "Hallo Welt" as the name and confirm.

On the left you see the project view, a kind of navigator that shows all the files of your project. On the right is the editor, in which you write the code. Here you can also switch the view to full screen if needed so that you have more space.

Now enter the classic line print("Hallo Welt"). This statement outputs the text in the console. With that, you have written your first own Python program.

Installing Python on Windows: A Beginner's Guide

Step 11: Run the Program

To start the program, click "Run" in the top menu bar and then select "Run". The first time, PyCharm may ask you whether you want to create a configuration. In this case, it is enough to select the file "Hallo Welt" and run it. The output "Hallo Welt" now appears at the bottom of the window.

If you subsequently change the code, for example to "Hallo Welt, was für ein Tag", you can run the program again. There is a green start button at the top right for this. It is faster with the keyboard shortcut Alt+Shift+F10. Also take a look at the shortcuts in the "Run" menu. You can customize them later according to your wishes.

Installing Python on Windows: A Beginner's Guide

Summary – Installing Python on Windows

You now have everything you need to get started. You installed the interpreter from python.org and set the PATH option in the process. You tested in the command prompt whether Python works. In addition, you set up PyCharm, created a project, and wrote and ran your first program. You will deepen your work with PyCharm in a further step, but your foundation is already in place.

FAQ

Do I really need an interpreter and an editor?Yes, each has its own job. The interpreter runs your Python code, and the editor or development environment is used to write the code.

Why should I check the "Add python.exe to PATH" box?With this box checked, Windows finds the python command in any command prompt without you having to specify the path manually.

What happens if I forgot the PATH option?The python command may not be recognized in the command prompt. In that case, you can restart the installation and set the option afterwards, or add the environment variable manually.

Is PyCharm free?The Community Edition of PyCharm is free and can be used for an unlimited time. It is more than enough for getting started.

Why should I not associate PyCharm with .py files?With an association to PyCharm, a double-click only opens the editor. With the Python association, on the other hand, you can run scripts directly in Explorer.

What does the 260-character limit mean?It is an older limit for file paths on Windows. It can cause problems with long project paths, so you should disable it if the installer offers an option for this.

How do I run a Python program in PyCharm?You select the Run option in the Run menu or use the keyboard shortcut Alt+Shift+F10.

Jan Brinkmann
Trainer About Jan Brinkmann Web development with passion! Jan has been a developer for over 15 years. All courses by Jan Brinkmann