Skip to content
Commitpedia
Log in Join & edit

Install Python on Linux, macOS and Windows

Install a current Python 3 with pip and venv on each desktop OS, check the version, and avoid the classic traps: python vs python3, the Windows Store alias and externally managed environments.

Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?

Edit history of Install Python on Linux, macOS and Windows: 1 recorded edit
Edit history · 1 edit
Type
Article
Edits
1
Editors
1
First issued
15 Oct 2026
Last edit
15 Oct 2026
Reading
2 min

Which option to pick

On Linux and macOS a Python 3 is often already present because the system uses it, but you should not install packages into that copy. Install a separate current Python through the package manager (or python.org) and always create a virtual environment per project with python3 -m venv. On Windows there is no system Python; the python.org installer is the standard choice. If you need several Python versions side by side, look at uv or pyenv, but for a first install the steps below are enough.

Step: Linux

Debian and Ubuntu:

Check before you run this

  • Runs with administrator rights. Make sure you understand every line.
sudo apt update
sudo apt install python3 python3-venv python3-pip

Fedora, RHEL and derivatives:

Check before you run this

  • Runs with administrator rights. Make sure you understand every line.
sudo dnf install python3 python3-pip

Arch Linux: sudo pacman -S python python-pip. The python3-venv package is separate on Debian and Ubuntu and is required for python3 -m venv to work.

Step: macOS

brew install python

Homebrew installs the current Python 3 as python3 and pip3, with unversioned python and pip links in its libexec/bin directory. Alternatively download the macOS installer from python.org; it installs into /Library/Frameworks and adds itself to PATH. The python3 that Xcode’s command line tools provide works too, but is updated only with macOS.

Step: Windows

In PowerShell, install the current release with winget (change 3.13 to the newest version listed by winget search Python.Python):

winget install Python.Python.3.13

Or run the installer from python.org. On the first screen tick Add python.exe to PATH before clicking Install Now. The installer also sets up the py launcher, which can start any installed version: py -3.13, py -3.12.

Check it works

python3 --version
python3 -m pip --version
python3 -m venv .venv

On Windows use python --version or py --version. Then activate the environment you just created: source .venv/bin/activate on Linux and macOS, .venv\Scripts\Activate.ps1 in PowerShell. Inside it, pip install works without sudo and without touching the system.

Common problems

  • python: command not found on Ubuntu: only python3 exists. Use that name, or sudo apt install python-is-python3 to add the short name.
  • error: externally-managed-environment when running pip install: modern distributions block installing into the system Python. Create a venv and install inside it.
  • On Windows, python opens the Microsoft Store: Windows ships a stub that does this. Either install from the Store, or disable the stub under Settings, Apps, Advanced app settings, App execution aliases, after installing from python.org.
  • python3 -m venv fails with ensurepip is not available on Debian or Ubuntu: install python3-venv.
  • .venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled: run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once in PowerShell.

Official documentation

Did this work for you?

No votes yet. Be the first.

If it did not work, the report form below tells the editors what went wrong.

See also

  • 0001 Virtual environments with venv A virtual environment is a private folder of Python packages for one project, so projects never fight over versions. Create one with… Beginner · Explains an idea · Any system Article Environments & packages 15 Oct 2026
  • 0007 Fix: ModuleNotFoundError: No module named ‘…’ Python cannot find a module you import. Usually the package was installed into a different interpreter or virtual environment than the one… Beginner · Fixes an error · Any system Article Common errors · Environments & packages 15 Oct 2026
  • 0011 Bootstrap a new Python project with a venv A Bash script that creates a project folder with a virtual environment, .gitignore, requirements.txt and a starter main.py, then runs it to… Intermediate · Step by step · Linux, macOS Script Environments & packages 15 Oct 2026
  • 0261 Build a Python command-line to-do app: from empty folder to installable command Create a small to-do tool in Python with argparse and JSON storage, test it with pytest and package it with pyproject.toml so… Beginner · Guided project · Any system Article Environments & packages · Files & automation · Testing 15 Oct 2026
  • 0282 What is a dependency? A dependency is another piece of software your program needs to work, such as a library it imports. Beginner · Explains an idea · Any system Article Environments & packages 15 Oct 2026
  • 0283 What is a virtual environment? A virtual environment is a private folder of Python packages for one project, so different projects never clash. Beginner · Explains an idea · Any system Article Environments & packages 15 Oct 2026

Repos in the wild

  • uv: Python package and project manager astral-sh/uv uv is a very fast Python package and project manager written in Rust. It replaces pip, venv and related tools, manages lock files and can install Python itself. GitHub

History

Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.

  1. Dominik +2,939 chars

Report a problem

Something wrong, unsafe or copied? Tell the editors.
What is wrong?