Installing the distribution-managed Python 3 runtime on Ubuntu or Debian gives scripts, automation jobs, and package-managed tooling a supported interpreter that stays aligned with the operating system's own update path. Using the packaged runtime avoids mixing shell work with a source build, alternate version manager, or ad-hoc binary drop.

On both distributions, apt resolves the default interpreter through the python3 package. That dependency package pulls in the release's supported Python 3 binary and base libraries, while optional components such as pip and the venv module stay separate so minimal installs do not broaden the runtime automatically.

Fresh installs still do not guarantee the unversioned python command, because the compatibility alias lives in the separate python-is-python3 package. When a project also needs isolated package installs or PyPI workflows, add python3-venv or python3-pip deliberately instead of folding those tools into the base interpreter step.

Steps to install Python 3 on Ubuntu or Debian:

  1. Refresh the local apt package index before resolving the interpreter package.
    $ sudo apt-get update
    ##### snipped #####
    Reading package lists... Done

    Repository lines, transfer totals, and mirror names vary by distribution release and architecture, so the example keeps only the decisive success line from the refresh.

  2. Install the default distribution-managed Python 3 package.
    $ sudo apt-get install --yes python3
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following NEW packages will be installed:
      python3 python3-minimal python3.12 python3.12-minimal
    ##### snipped #####
    Setting up python3 (3.12.3-0ubuntu2.1) ...

    The python3 package stays as the default interpreter package on current Ubuntu and Debian releases, but the minor version follows the release. Current live installs return Python 3.12 on Ubuntu 24.04 LTS and Python 3.13 on current Debian stable.

    Optional tools stay separate. Add python3-venv for the built-in virtual environment module and python3-pip when the host also needs the packaged pip command.

  3. Confirm that the interpreter is installed and that the shell resolves the packaged binary from /usr/bin.
    $ python3 --version
    Python 3.12.3
    $ command -v python3
    /usr/bin/python3

    The exact version string depends on the operating-system release and enabled repositories, but the packaged interpreter path normally resolves to /usr/bin/python3.

  4. Check whether the unversioned python command exists before using copied snippets or legacy scripts that expect it.
    $ python --version
    /bin/sh: 1: python: not found

    The exact shell error text varies, but installing only python3 on current Ubuntu 24.04 LTS and current Debian stable still leaves python absent. Install python-is-python3 only when a third-party tool specifically expects the unversioned command.