Here’s a detailed overview of your options for installing Python. If you’re looking for help deciding, then go for the official installers if using Windows or macOS.
This text is part of a Real Python tutorial by Leodanis Pozo Ramos.
Installing Python on your system involves a few straightforward steps. First, check if Python is already installed by opening a command-line interface and typing python --version or python3 --version. You can install Python on Windows using the official installer from python.org or through the Microsoft Store. On macOS, you can use the official installer or Homebrew. For Linux, use your package manager or build Python from source.
This lesson covers installing the latest Python on the most common operating systems: Windows, macOS, and Linux. It doesn’t cover all the existing Linux distributions but focuses on the most popular Linux distributions available today.
Windows: How to Check or Get Python
In this section, you’ll learn to check whether Python is installed on your Windows operating system (OS) and which version you have. You’ll also explore three installation options that you can use on Windows.
Note: In this tutorial, you’ll focus on installing the latest version of Python in your current operating system (OS) rather than on installing multiple versions of Python. If you want to install several versions of Python in your OS, then check out the Managing Python Projects With uv: An All-in-One Solution.
Checking the Python Version on Windows
To check whether you already have Python on your Windows machine, open a command-line application like PowerShell or the Windows Terminal.
Follow the steps below to open PowerShell on Windows:
- Press the Win key.
- Type
PowerShell. - Press Enter.
Alternatively, you can right-click the Start button and select Windows PowerShell or Windows PowerShell (Admin). In some versions of Windows, you’ll find Terminal or Terminal (admin).
With the command line open, type in the following command and press the Enter key:
PS> python --version
Python 3.x.z
Using the --version switch will show you the installed version. Note that the 3.x.z part is a placeholder here. In your machine, x and z will be numbers corresponding to the specific version you have installed.
Alternatively, you can use the -V switch:
PS> python -V
Python 3.x.z
Using the python -V or python—-version command, you can check whether Python is installed on your system and learn what version you have. If Python isn’t installed on your OS, you’ll get an error message.
Knowing the Python Installation Options on Windows
You’ll have different options to install Python if you’re on a Windows machine. Here are three popular ones:
- The official Python installer for Windows: This approach involves downloading the Python installer directly from the python.org website. It’s recommended for intermediate and advanced developers who need more control during the setup process.
- The Microsoft Store: The quickest installation option on Windows involves using the Microsoft Store app. This is recommended for beginner Python programmers looking for an easy-to-set-up interactive experience.
- The Windows subsystem for Linux (WSL): The WSL allows you to run a Linux environment directly on Windows.
In this section, you’ll focus on only the first two options, which are the most popular ones on Windows environments.
Note: You can also complete the installation on Windows using alternative distributions, such as Anaconda, but this tutorial covers only official distributions.
Anaconda is a popular platform for scientific computing and data science with Python. To learn how to install Anaconda on Windows, check out the Setting Up Python for Machine Learning on Windows tutorial.
If you want to install Python in the WSL, you can read the Linux-related sections of this tutorial after installing the Linux distribution of your choice.