← 输入框|python.land|刷新

Install Python: Detailed Instructions for Windows, Mac, and Linux

To install Python, get it from python.org or from your operating system’s package manager. It’s free on every platform, and it takes a few minutes. This page shows the best way for Windows, macOS and Linux, how to do it from the command line, and how to check that it worked. It’s the first step of the free Python tutorial.

Quick answer: how to install Python

Your computerBest way to install PythonCommand to run it
WindowsThe Python install manager, from python.org or the Microsoft Storepython or py
macOSbrew install python, or the installer from python.orgpython3
Linux (Ubuntu, Debian, Mint)sudo apt install python3 python-is-python3 python3-venv python3-pippython or python3
Linux (Fedora)sudo dnf install python3python3
Any system, from the terminaluv python installuv run python

Whatever you pick, choose a method that keeps Python up to date for you. On Windows that’s the Python install manager. On Linux and macOS it’s usually a package manager: the one that comes with your Linux distribution, or Homebrew on a Mac. Then check your installation with python --version. If you’d rather not install anything yet, you can also start in your browser.

Install Python on Windows

Windows doesn’t come with Python. There are three good ways to get it: the Python install manager, the older classic installer, or Linux inside WSL. For almost everyone, the install manager is the right choice.

With the Python install manager (recommended)

Since Python 3.14, python.org recommends the Python install manager for Windows. It’s a small official tool that installs Python versions for you and keeps itself up to date. You can get it in two ways, and both give you exactly the same thing:

  1. Download it from the Python download page and double-click the file to install it.
  2. Open the Microsoft Store app, search for “Python install manager”, and click Install.

Then open a new terminal (PowerShell or Command Prompt) and type python. If no Python is installed yet, the install manager downloads and installs the latest version first, and then starts it. The first time you install a version, it may ask whether to add a directory to your PATH. That’s optional: the python and py commands work either way.

The py command manages your installed versions:

# Show the installed versions, and which one is the default
py list
# Install a specific version
py install 3.15
# Run a specific version
py -V:3.15
# Remove a version
py uninstall 3.14Code language: Python (python)
py list in Windows PowerShell, showing Python 3.15.2 installed by the Python install manager
py list shows the Pythons that the install manager knows about

There’s also a python3 command, but it’s only there to catch people who are used to macOS or Linux. On Windows, use python or py.

Install Python from the command line (cmd or PowerShell)

If you prefer the command line, or you set up machines with a script, install the install manager with winget, which comes with Windows 10 and 11. The odd-looking ID is the install manager’s Microsoft Store ID:

winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-interactivityCode language: Python (python)

Then open a new terminal and run py install 3.15 to install Python itself, or just type python and let it install the latest version.

“Python was not found; run without arguments to install from the Microsoft Store”

You get this message, or the Microsoft Store opens, when you type python on a Windows computer that has no Python. Windows has a shortcut called an app execution alias that catches the python command and points you to the Store. Nothing is broken. You have two options:

  • Install Python. Install the Python install manager as described above, open a new terminal, and type python again. Terminals that were already open don’t see the change.
  • You did install Python, and still get the message. Open the Start menu, search for “Manage app execution aliases”, and check that the “Python (default)” and “Python install manager” aliases are on. If they’re on already, switch them off and on again. If you used the classic installer instead, switch the two “App Installer” python aliases off, so Windows finds your own Python on the PATH.

With the classic installer

The Python download page still offers the classic Windows installer for each version, but it’s deprecated since Python 3.14 and won’t be made for Python 3.16 or later. If you use it anyway, for example because you’re following an older course, tick the checkbox that says ‘Add python.exe to PATH’ on the first screen:

The classic Python 3.15 installer for Windows, with the Add python.exe to PATH checkbox at the bottom
Tick 'Add python.exe to PATH' at the bottom of the first screen

If you forget that checkbox, the python command won’t be found later. The easiest fix is to run the installer again, choose Modify, and turn on the PATH option.

Inside WSL

If you’re familiar with the Windows Subsystem for Linux, you may want to consider that option. It’s what I use myself, and I love it. It gives me the advantages of Windows (mainly great hardware support) while I work in Linux, which is, in my opinion, the best platform for Python development.

To install Python in WSL, you’ll first need to install WSL itself. After that, follow the Linux instructions below. Ubuntu, the default WSL distribution, already includes Python 3.

Install Python on a Mac

macOS doesn’t include a Python you’ll want to use. If you type python3 on a fresh Mac, it may offer to install Apple’s command line developer tools, which come with a Python 3 that is usually several versions behind. There are two better ways to install a current Python on a Mac, and both work on Apple silicon and Intel Macs.

Homebrew

I recommend Homebrew. It lets you install almost any developer tool with one command, and it has two clear benefits for Python:

  • Homebrew packages are usually very up to date.
  • Upgrading later is one command: brew upgrade.

You do need to be comfortable typing commands in the Terminal app. If that’s entirely new to you, use the official installer below for now. With Homebrew installed, installing Python on macOS is one line:

$ brew install pythonCode language: Python (python)

The command is called python3 afterwards. On my Mac it gives:

$ python3 --version
Python 3.15.2Code language: Python (python)

Homebrew’s Python won’t let you install packages into it with pip directly; you use a virtual environment for that, which is a good habit anyway.

Official installer

You can also download a macOS installer from the Python download page. It works like installing any other Mac program. The downside is that you don’t get automatic updates: to upgrade, you download and run the installer for the newer version. At the end of the installation, run the “Install Certificates” command in the Python folder in Applications, so Python can make secure web requests.

Install Python on Linux

On Linux you often don’t need to install Python at all. Check first, then use your distribution’s package manager if it’s missing.

Check what’s installed first

Most Linux distributions include Python 3. Enter python3 --version on the command line to see the version number. This is what a fresh Ubuntu 26.04 says:

$ python3 --version
Python 3.14.4Code language: Python (python)

If you get “command not found”, install Python 3 with the package manager. On many distributions the plain python command doesn’t exist at all, even when python3 works. That’s normal; the next section shows how to add it.

Using a package manager

Each Linux distribution has its own package manager. These are the commands for the common ones.

Ubuntu, Linux Mint and Debian use apt:

$ sudo apt update
$ sudo apt install python3 python-is-python3 python3-venv python3-pipCode language: Python (python)

The package called python-is-python3 makes the command python point to python3. Trust me when I say it will save you a lot of headaches later on. The other two give you virtual environments and pip, which you’ll need as soon as you want to install packages.

Fedora includes Python already. If it’s missing, use sudo dnf install python3. The venv module is included; add python3-pip if the pip command is missing.

Arch Linux and Manjaro: sudo pacman -S python. Here the command is simply python.

openSUSE: sudo zypper install python3.

The Python from your distribution is often a version or two behind the latest release, and that’s fine for learning. If you need a newer version, use uv or Homebrew, described below, and leave the system Python alone: parts of your operating system depend on it. Never remove or replace it.

Homebrew

Another option for Linux is Homebrew. That’s right, the package manager for Macs also works on Linux. Its advantages:

  • You get the latest version of Python, instead of the version your distribution shipped with.
  • You don’t need root access for the packages you install with Homebrew.

I find myself using Homebrew more and more on Linux. Once it’s installed, brew install python works the same as on a Mac.

Any OS: uv python install

If you’re comfortable on the command line, uv is a fast tool that works the same on Windows, macOS and Linux. Besides creating virtual environments and installing packages, it can download and install Python versions for you. After installing uv:

$ uv python install 3.15
Installed Python 3.15.2 in 2.57s
 + cpython-3.15.2-macos-aarch64-none (python3.15)Code language: Python (python)

These Pythons live in uv’s own directory and don’t touch the rest of your system, so it’s an easy way to try a new version or to keep several side by side. You’ll typically use one for a project:

$ uv venv --python 3.15
Using CPython 3.15.2
Creating virtual environment at: .venv
Activate with: source .venv/bin/activateCode language: Python (python)

For a first, general-purpose Python on your computer, the options above are simpler.

Check your Python installation

Open a new terminal after installing, so it picks up the new command, and ask Python for its version. On Windows, and on Linux with python-is-python3:

python --versionCode language: Python (python)

On macOS and most other Linux systems:

python3 --versionCode language: Python (python)

If you see something like Python 3.15.2, you’re done. Type python (or python3) without anything after it to start the interactive Python shell, with its >>> prompt, and try it:

>>> print("Hello from Python")
Hello from Python
>>> exit()Code language: Python (python)

The next article, how to open Python, explains the different ways to start it, and the Python REPL shows what you can do at that prompt.

Which Python version should I install?

Install the newest version that python.org offers, which is Python 3.15 at the moment. You’ll see 3.16 listed as an alpha or beta: skip those, they’re previews for testing. Python 2 is long gone; never install it for new work.

If your Linux distribution comes with a slightly older Python 3, such as 3.13 or 3.14, that’s fine for learning and for this tutorial. Python 3.10 has reached the end of its life and no longer gets security fixes, so if that’s what you have, upgrade.

Python in your browser

If you don’t feel like installing Python, or you cannot install it, for example on a school or work computer, you can use Python right from your browser. No installation is necessary.

Want to try Python before installing it? Try Python in your browser with a free exercise on our new learning platform. You can return to these installation instructions whenever you’re ready.

Python installation FAQ

Is Python free?

Yes. Python is open source and free to download and use, also for commercial work, on Windows, macOS and Linux. The Python install manager in the Microsoft Store is free too. If a website asks you to pay for a Python download, you’re in the wrong place: get it from python.org, the Microsoft Store, or your system’s package manager.

Where should I install Python?

Let the installer decide. The Python install manager on Windows, Homebrew, and the Linux package managers all put Python in a standard location and set up the commands for you. Choosing your own folder mostly causes PATH problems later.

What is the Python launcher (py)?

On Windows, py is the command that picks which installed Python version to run. With the Python install manager, py also installs and removes versions (py install, py list, py uninstall). The older, separate Python launcher that came with the classic installer has been replaced by the install manager.

Do I need to install pip separately?

Usually not. The installers from python.org and Homebrew include pip. On Debian, Ubuntu and Mint it’s the python3-pip package from the apt command above. Read how to install packages with pip to learn how to use it.

Learn more

This article is part of a free Python tutorial. You can browse the tutorial with the navigation buttons at the top and bottom of the article, or use the navigation menu. Most installation methods above also give you pip, the tool that installs Python packages that don’t come with Python itself. On Fedora you may need to add the python3-pip package, and with uv you install packages through uv itself. Later in this tutorial, we’ll look at how to use pip inside a virtual environment, and at tools that do even more, like Python Poetry and uv.

Related articles