Before you can write and run Python programs, you need the Python interpreter installed on your computer. The interpreter is the program that reads your .py files and runs them.
In this tutorial, you’ll learn how to install the latest Python 3 on Windows, macOS, and Linux, check that it works, use pip to install packages, create a virtual environment, and fix the most common installation problems.
Key terms used in this article:
- Interpreter: The program that runs your Python code. Installing Python means installing the interpreter.
- Terminal: A text window where you type commands, also called the command line, Command Prompt, or PowerShell on Windows.
- PATH: A list of folders your computer searches when you type a command. Python must be in it for the
pythoncommand to work. - Package: Extra code written by other people that you can install and use in your programs.
- pip: The tool that installs packages.
- Virtual environment: A separate, private space for one project’s packages.
Table of contents
Before you install
Which version to install
Always install the latest stable Python 3 release, unless a course or project asks for a specific version. At the time of writing, that is Python 3.15, released in October 2026. You can always find the current version at python.org/downloads.
- Never install Python 2. It reached end of life in 2020.
- Avoid versions marked alpha, beta, or release candidate. They are previews for testing.
- Python version numbers have three parts, such as
3.15.1. The last number is a bug-fix release, so3.15.1and3.15.2are the same feature version.
Check if Python is already installed
Python may already be on your computer. Open a terminal and run one of these commands:
If you see a version such as Python 3.15.1, Python is installed. If the version is old or you get an error such as “command not found”, follow the steps for your operating system below.
How to open a terminal
Most installation steps use a terminal (also called the command line or console):
- Windows: Press the Windows key, type Terminal (or PowerShell), and press Enter.
- macOS: Press Cmd + Space, type Terminal, and press Enter.
- Linux: Press Ctrl + Alt + T on most distributions, or find Terminal in your applications menu.
What is PATH?
You’ll see the word PATH several times in this guide. PATH is a setting on your computer that holds a list of folders. When you type a command such as python in a terminal, your computer looks through those folders to find a program with that name.
If the folder where Python is installed isn’t in PATH, the computer can’t find it, and you get an error such as “python is not recognized” or “command not found”, even though Python is installed. The installers below can add Python to PATH for you, so follow those steps carefully.
Install Python on Windows
Windows doesn’t include Python. The Python team now provides the Python install manager, a small tool that installs Python and lets you manage several versions. It replaces the traditional .exe installer, which is deprecated and won’t be produced for Python 3.16 or later.
Option 1: Python install manager (recommended)
Choose one of these three ways to get the install manager. They all give you the same tool.
A. From the Microsoft Store (easiest)
- Open the Microsoft Store app and search for Python Install Manager. Make sure the publisher is the Python Software Foundation.
- Click Install.
- Open a new terminal and type
python. If no Python version is installed yet, the install manager downloads and installs the latest stable release for you.
B. From python.org
- Go to python.org/downloads and download the Python install manager (an
.msixfile). - Double-click the downloaded file and click Install.
C. With WinGet (from a terminal)
The first time you run py or python, the install manager runs a short configuration checker. It may offer to add %LocalAppData%\Python\bin to your PATH and to enable long file paths. Accepting these suggestions is a good idea. You can run the checker again at any time and accept all changes with:
Now install the latest Python (if it wasn’t installed automatically) and check it:
Output:
Python 3.15.1
Manage Python versions with the py command
The install manager gives you several commands. You will mainly use python to run your code and py to manage versions.
| Command | What it does |
|---|---|
python | Starts the default Python version (or the active virtual environment) |
py | Also starts the default Python, and manages versions |
py list | Lists the installed Python versions and shows the default |
py list --online | Lists the versions available to install |
py install 3.14 | Installs another version, such as Python 3.14 |
py -V:3.14 script.py | Runs a script with a specific version |
py uninstall 3.14 | Removes a version |
py help | Shows all commands |
Note: If you previously installed Python with the old installer, uninstall the separate Python Launcher app from Settings › Apps › Installed apps. Both use the py command, and the old launcher can take priority over the install manager.
Option 2: Traditional installer
Python 3.15 is the last version also released as a traditional .exe installer. Some schools and companies still use it. If you need it:
- On python.org, open the Python 3.15 release page and download the Windows installer (64-bit). Choose the ARM64 version if your PC has an ARM processor.
- Run the installer. On the first screen, check the box “Add python.exe to PATH”. This step is easy to miss and is the cause of most “python is not recognized” errors.
- Click Install Now and wait for it to finish.
- If offered, click Disable path length limit, then close the installer.
- Open a new terminal and run
python --version.
Install Python on macOS
macOS may include a python3 command that comes with Apple’s developer tools. It is usually an older version meant for Apple’s own tools, so install the latest Python yourself. Use either the official installer or Homebrew, not both.
Option 1: python.org installer
- Go to python.org/downloads and click the download button for the latest macOS version. You get a
.pkgfile that works on both Apple Silicon (M-series) and Intel Macs. - Open the
.pkgfile and follow the steps: Continue, agree to the license, then Install. Enter your Mac password when asked. - When it finishes, a Finder window opens in Applications › Python 3.15. Double-click Install Certificates.command. This installs the SSL certificates Python needs to download files over HTTPS.
- Open a new Terminal window and check the version.
Output:
Python 3.15.1
Note: On macOS and Linux, use python3 and pip3 instead of python and pip. Inside an activated virtual environment, plain python and pip work too.
The installer also adds IDLE, Python’s simple built-in editor, to your Applications folder.
Option 2: Homebrew
Homebrew is a popular package manager for macOS. If you already use it, install Python with:
Upgrade later with brew upgrade python@3.15. Homebrew’s Python doesn’t allow pip install into the system-wide environment, so install packages inside a virtual environment.
Install Python on Linux
Almost every Linux distribution comes with Python 3 already installed, because many system tools are written in it. Check your version with python3 --version. If it’s recent enough for your needs, you’re ready to go.
Warning: Never remove or replace the system Python on Linux. Your operating system depends on it. Install newer versions alongside it, as shown below.
Ubuntu and Debian
Install the distribution’s Python together with pip and the venv module:
Optional: If you need a newer version than your Ubuntu release provides, you can use the community-maintained deadsnakes PPA. A PPA is an extra source of software packages for Ubuntu.
The new version is available as python3.15, while python3 still points to the system version.
Fedora, RHEL, and CentOS Stream
Arch Linux
Arch usually ships the newest Python soon after release:
Advanced: Build Python from source
Advanced and optional: You only need this if your package manager doesn’t offer the version you need. Most beginners can skip this section. The example below is for Ubuntu or Debian. First, install the tools and libraries needed to build Python:
Then download, build, and install it. Replace 3.15.1 with the latest version number from python.org:
Use make altinstall, not make install. altinstall installs the new version as python3.15 without overwriting the system’s python3 command.
Optional: Install Python with uv (any OS)
uv is a fast, popular third-party tool that can install Python versions, create virtual environments, and manage packages. It works the same way on Windows, macOS, and Linux, and it doesn’t need administrator rights. It’s a good choice if you work with several Python versions.
Beginners can skip this section. The official installers above are the simplest way to get started. Come back to uv later, once you’re comfortable using the terminal.
Verify your installation
Whatever method you used, open a new terminal and run these checks. Use python on Windows and python3 on macOS and Linux.
1. Check the version
2. Start the interactive shell and run a line of code
You’ll see the >>> prompt. Type a statement and press Enter:
>>> print("Python is installed!")
Python is installed!
>>> exit()
3. Find out where Python is installed
From the terminal, where python (Windows) or which python3 (macOS and Linux) also shows which Python the command runs.
Install packages with pip
pip is Python’s package installer. It downloads packages from the Python Package Index (PyPI) and comes with every recent Python install. The most reliable way to run it is through Python itself with -m pip, which guarantees that pip installs packages for the same Python you run:
On macOS and Linux, replace python with python3, or activate a virtual environment first (recommended).
Create a virtual environment
A virtual environment is a private folder with its own copy of the Python interpreter and its own packages. Each project gets its own environment, so packages from one project can’t break another. It’s best practice to create one for every project.
When the environment is active, your terminal prompt starts with (.venv), and python and pip refer to the environment’s copies on every operating system.
Troubleshooting common installation problems
1. “python is not recognized as an internal or external command” (Windows)
- Close the terminal and open a new one. Terminals read
PATHonly when they start. - With the install manager, run
py install --configure -yto fix the configuration. - With the traditional installer, run it again, choose Modify, and make sure Python is added to the environment variables (PATH).
2. Typing python opens the Microsoft Store (Windows)
Windows has placeholder shortcuts called “app execution aliases”. Open Settings, search for Manage app execution aliases, and check that the aliases belonging to the Python install manager are turned on and that any leftover “App Installer” Python aliases are turned off.
3. “command not found: python” (macOS and Linux)
Use python3 instead. Many systems don’t create a plain python command. On Ubuntu and Debian, you can install the python-is-python3 package if you want python to work as well.
4. “error: externally-managed-environment” when running pip
Many Linux distributions and Homebrew block pip install into the system Python so you can’t break operating system tools. This is intentional. Create and activate a virtual environment, and then install the package inside it.
5. “CERTIFICATE_VERIFY_FAILED” SSL errors (macOS)
Open Applications › Python 3.15 and double-click Install Certificates.command.
6. The wrong Python version runs
Several versions can be installed at once. Run where python (Windows) or which -a python3 (macOS and Linux) to see all of them in order of priority. Call a specific version directly, such as py -V:3.15 on Windows or python3.15 on macOS and Linux, or use a virtual environment created with the version you want.
Summary
- Install the latest stable Python 3 release (Python 3.15 at the time of writing) from python.org or your system’s package manager.
- Windows: Use the Python install manager from the Microsoft Store, python.org, or WinGet. Use
pythonto run code andpyto manage versions. If you use the traditional installer, check “Add python.exe to PATH”. - macOS: Use the python.org
.pkginstaller (and run Install Certificates.command) orbrew install python@3.15. Use thepython3command. - Linux: Python 3 is usually preinstalled. Add newer versions alongside it with your package manager, the deadsnakes PPA, or
make altinstall. Never remove the system Python. - Verify with
python --versionorpython3 --version, and by running a line of code in the interactive shell. - Install packages with
python -m pip install, inside a virtual environment created withpython -m venv .venv.
Next steps: Choose and set up a code editor in Setting Up VS Code, PyCharm, and Jupyter for Python, then write your first Python program.

Leave a Reply