How to Install Python on Windows and Linux: Step-by-Step Guide
How to install Python the right way on Windows, with the new Python Install Manager, and on Linux, and how to check that everything works.
Python is one of the most widely used programming languages in the world: you can use it to write scripts that automate repetitive tasks, analyse data, build web applications and connect different services through APIs. Before writing your first line of code, though, you need to install it the right way.
In recent months the procedure on Windows has changed: the classic installer downloaded from python.org is giving way to the new Python Install Manager. Many guides you find online still describe the old method. In this article we look at how to install Python today on Windows and Linux, which version to choose and how to solve the most frequent problems.
Which version of Python to choose
Python releases a new major version every year. The latest, Python 3.15, was released on 9 October 2026. When a new version comes out, however, not all libraries are ready straight away: some take weeks or months to publish compatible packages.
So here is a practical tip:
- For learning and experimenting, the latest version is perfectly fine.
- For projects that use many external libraries, it is better to use the previous version, currently 3.14, until the libraries you need support the new one.
As we will see, with the new Install Manager you can keep several versions installed at the same time and choose which one to use for each project.
Installing Python on Windows with the Python Install Manager
The Python Install Manager is the Python team's official tool for installing and managing Python on Windows. It is not Python itself: it is a small program that downloads, updates and removes the Python versions you need. The traditional installer will no longer be published from Python 3.16 onwards, so this is the method to learn.
It works on Windows 10, Windows 11 and Windows Server 2022 or later.
Step 1: install the Install Manager
You have three options, all equivalent:
- Microsoft Store: search for “Python Install Manager” and click Install. This is the recommended method for most users, because updates arrive automatically.
- Official website: download the package from the python.org downloads page and double-click it.
- Command line: if you use WinGet, open the Command Prompt and type:
winget install 9NQ7512CXL7T
If a version of Python was already installed on the computer with the old method, it is a good idea to uninstall the old “Python Launcher” from Settings → Apps, because it also uses the py command and the two could conflict. Python versions that are already installed, on the other hand, can stay.
Step 2: initial configuration
Open the Command Prompt (search for “cmd” in the Start menu) or the Terminal and type:
py install --configure
A guided check starts and verifies your system configuration. You will probably be asked to add a folder to the PATH variable: answer yes. PATH is the list of folders where Windows looks for programs when you type a command; without this step some commands would not be found.
Step 3: install a Python version
To install a version, give its number. For example, for the latest version and the previous one:
py install 3.15
py install 3.14
You can repeat the command with different versions: they will all remain available. To see which versions you have installed and which one is the default:
py list
To see which versions you can install:
py list --online
Step 4: run Python
After installation you have three commands available:
pythonstarts the default version, which is normally the most recent one you installed.pydoes the same, but also lets you choose the version with the-V:option, for examplepy -V:3.14.pymanageris used to manage installations. It is useful above all if the old launcher is still on the computer and thepycommand is “taken”.
For example, to run a script with a specific version:
py -V:3.14 my_script.py
For the full command reference there is always py help, and for the details of a single command, for example py help install.
Updating and uninstalling
The Install Manager updates itself within a day of a new release. The installed Python versions, instead, are managed with the py install and py uninstall commands, for example:
py uninstall 3.13
Uninstalling the Install Manager does not remove the Python versions already installed. For a complete clean-up there is the py uninstall --purge command.
Installing Python on Linux
On Linux the situation is different: almost all distributions already have Python installed, because many system tools use it. To check, open the terminal and type:
python3 --version
On Linux the command is usually called python3, not python.
Ubuntu and Debian
Even if Python is present, two essential components are often missing: pip, the program that installs libraries, and the venv module, which is used to create virtual environments. Install them like this:
sudo apt update
sudo apt install python3 python3-pip python3-venv
Fedora, Rocky Linux, AlmaLinux
sudo dnf install python3 python3-pip
On these distributions the venv module is already included in the main package.
An important rule on Linux
Do not remove or replace the system Python, not even to get a newer version: parts of the operating system depend on it and you could make the system unstable. Likewise, avoid installing libraries with sudo pip install. Recent distributions prevent it with the externally-managed-environment error, precisely to protect the system.
The right solution is to always work inside a virtual environment, a topic we cover in a dedicated article in this same category.
Check that everything works
Let's do a complete test. Create a text file called hello.py with this content:
import sys
print("Python works!")
print("Version in use:", sys.version)
Then, from the folder where you saved the file, run it:
# Windows
python hello.py
# Linux
python3 hello.py
If the message and the version number appear, Python is installed correctly.
Common problems on Windows
- Typing
pythonopens the Microsoft Store. This is a Windows shortcut called an “app execution alias”. Go to Settings → Apps → Advanced app settings → App execution aliases and turn off the “python.exe” and “python3.exe” entries that point to the Store installer. Alternatively, simply use thepycommand. - “py” is not recognised as a command. Close and reopen the terminal: changes to PATH only apply to windows opened after the installation. If the problem persists, run
pymanager install --configureagain. - The
pycommand starts an old version. The old Python Launcher is still active: uninstall it from Settings → Apps, or use thepymanagercommand. - Errors while installing libraries with pip, such as “Microsoft Visual C++ 14.0 or greater is required”. They usually depend on a Python version that is too recent: we cover this in a dedicated article.
Next steps
With Python installed you are ready to start. The recommended next step is to learn how to use virtual environments: they let you install each project's libraries separately, without conflicts and without touching the system. It is the habit that separates people who program in Python without trouble from those who spend hours chasing installation errors.
Official sources
Share
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0