guide 06 / 08

How to Install CPython: Installers, Package Managers or GitHub Source

How to install CPython on Windows, macOS and Linux, from the python.org installer, a package manager, or by building the CPython GitHub source.

Bytecode-style illustration for: How to install CPython (+ GitHub source)

TL;DR

  • Most people should use the python.org installer or their OS package manager.
  • Build from the CPython GitHub source to test unreleased features or contribute.
  • Use make altinstall on Linux so your system Python isn't replaced.
  • Verify any install with python -VV and sys.implementation.

01Pick your path

GoalMethod
Just write Pythonpython.org installer (Windows/macOS) or package manager (Linux)
Several versions side by sidePython Install Manager (Windows), pyenv or uv
Test the next releaseBuild the main branch from GitHub
Contribute to PythonFork + clone python/cpython and follow the Developer's Guide

02Windows

Download the Python Install Manager or the standalone 64-bit installer for 3.15.2 from python.org/downloads. If you use the standalone installer, tick “Add python.exe to PATH,” then verify:

py -V
python -c "import sys; print(sys.implementation.name)"

03macOS

The python.org .pkg installer for 3.15.2 targets macOS 11 or later and installs a python3 command. Homebrew users can run brew install python. Don't remove or modify any Python that macOS itself provides.

04Linux

Most distributions include CPython. Install or update it through your package manager:

# Debian / Ubuntu
sudo apt install python3 python3-venv
# Fedora
sudo dnf install python3

Distribution versions can lag behind python.org. For a newer one, use a version manager or build from source.

05Build from the CPython GitHub source

Download the source ZIP (or git clone https://github.com/python/cpython), then:

# Linux / macOS
cd cpython-main
./configure --enable-optimizations   # PGO; slower to build, faster to run
make -j"$(nproc)"
make test
sudo make altinstall
:: Windows (Visual Studio 2017+ with the Python development workload)
cd cpython-main
PCbuild\build.bat
PCbuild\amd64\python.exe -V

For a debug build with extra runtime checks, use ./configure --with-pydebug. The main branch is currently 3.16.0 alpha 1+dev, which is a development version.

06Exploring the CPython GitHub repository

  • Issues: bug reports and feature discussions at github.com/python/cpython/issues.
  • Pull requests: proposed changes, reviewed by core developers.
  • Branches: main for the next feature release, plus maintenance branches such as 3.15 and 3.14.
  • Developer's Guide: devguide.python.org explains setup, testing and the contribution workflow.

07Common installation problems

  • “python” opens the Microsoft Store on Windows: disable the App Execution Aliases for python.exe, or use the py launcher.
  • pip refuses to install system-wide on Linux: this protects the OS Python. Use a virtual environment instead.
  • Missing _ssl or _sqlite3 after building: install the dev headers for OpenSSL or SQLite and rerun ./configure.
  • Wrong version runs: check which python3 or where python to see which install comes first on PATH.

08Installing several versions side by side

Developers often need more than one Python, for example to test a library on 3.13, 3.14 and 3.15. Options:

  • Windows: the Python Install Manager and the py launcher manage multiple versions (py -3.14, py -3.15).
  • macOS/Linux: tools such as pyenv or uv download and switch between versions per project.
  • From source: use a different --prefix for each build plus make altinstall, so the versioned commands (python3.15, python3.16) don't collide.

09Keeping CPython up to date

Bugfix releases arrive about every two months. With an installer, download the newer one and run it. It upgrades the same minor version in place. With a package manager, update as usual. With a source build, pull the latest changes or download a fresh ZIP, then rerun configure and make. Feature releases, such as moving from 3.15 to 3.16, install side by side, so recreate your virtual environments after you switch.

10After installing

  1. Check the version: python3 -VV.
  2. Create a project environment: python3 -m venv .venv.
  3. Activate it and install packages with pip.

??Quick questions

Q01Is installing Python the same as installing CPython?

Yes, when you use python.org, the Microsoft Store, Homebrew or Linux packages.

Q02Do I need to compile CPython myself?

Only if you want unreleased code or want to contribute. Otherwise, use an installer.