Coding Agents & Terminal · recorded 2026-08-29 · applies to 1 tool(s) ✓ Verified

Problem: "python: command not found" on Ubuntu/WSL (python3 works fine) —— Trove problem library

Verified 2026-08-29python: command not found — Ubuntu ships python3 only; install the official python-is-python3 package with no side effects.

Quick fix

# One-liner: install python-is-python3 so python points to python3 (official package, no side effects)
sudo apt update && sudo apt install -y python-is-python3 && python --version

What you will run into

On Ubuntu/Debian (incl. WSL), python --version reports Command 'python' not found; you think Python isn't installed, search tutorials, reinstall — but python3 --version clearly works.

The problem isn't that Python is missing: the system simply has no python command.

Old tutorials and Windows habits hardcode python, which fails immediately.

Why this happens

Ubuntu 18.04+ stopped shipping a python command (only python3 is installed) — this is official design: deliberately avoiding python2/python3 confusion so scripts can't grab the wrong interpreter.

But tons of old tutorials, CI configs, and Windows users still write python, making "command not found" one of the most common walls for CN beginners.

  • Running python directly goes through the system PATH lookup; without python-is-python3 installed, Ubuntu has no such entry.
  • python3 existing ≠ python existing; they're independent command names.

Deterministic takeaway: on Ubuntu/WSL, first confirm the interpreter with which python3, then decide.

Change python to python3 in scripts and CI — the correct fix, aligned with the distro design.

Or install python-is-python3 (sudo apt install python-is-python3): it provides a python → python3 symlink for legacy scripts.

Do not rely on aliases — they do not load in non-interactive shells, so CI ignores them.

Fixed diagnostic: no output from command -v python means the entry does not exist, not that it is broken.

Step by step

1. First confirm it's this problem — Required

command -v python; echo "exit=$?"
python3 --version

command -v python empty while python3 --version works → this is the problem (measured consistent).

2. Install python-is-python3 (recommended) — Required

sudo apt update && sudo apt install -y python-is-python3

This is an official Ubuntu package; after install, python is a symlink to python3, affecting no existing environment.

3. If you don't want to install it, change how you call it — Required

  • Use python3 in site docs;
  • Write shebangs as #!/usr/bin/env python3 (most compatible; don't rely on python);
  • Or a temporary alias python=python3 in the current shell (only affects that shell).

How to confirm it works

python --version

A normal version output (e.g. Python 3.14.4) means success. Measured: before the fix python --version reported not found (exit=127); python3 --version → Python 3.14.4.

Other environments

EnvironmentNotes
Ubuntu/Debian 18.04+No python command; install python-is-python3
WSL UbuntuSame; note this is Linux-side behavior for Windows-habituated python users
venv virtual environmentvenv ships its own python; nothing to do
macOSShips python3; python depends on the Xcode CLT version; also recommended to write python3

Symptom

python fails on Ubuntu/Debian (incl. WSL):

$ python --version
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3
  • python3 --version works fine.
  • Scripts/tutorials hardcoding python fail immediately.

Cause

  1. Ubuntu 18.04+ intentionally stopped shipping the python command (python3 only) to avoid python2/python3 confusion.
  2. Old tutorials, scripts and Windows habits still write python.

Solution

  1. Temporary: use python3; or alias python=python3 (current shell only).
  2. System-level (recommended):
   sudo apt update && sudo apt install -y python-is-python3
   python --version
  1. Write scripts with python3 or shebang #!/usr/bin/env python3.
  2. Inside a venv, python works (venv provides it); the issue is only the system interpreter.
Verification Evidence
  • Local (WSL Ubuntu, 2026-08-29):
  • command -v python → empty, exit=1.
  • python --version → python: command not found, exit=127 — matches user error.
  • python3 --version → Python 3.14.4, exit=0.
  • python-is-python3 not installed (fix documented, not installed/tested).

Evidence details kept locally (2026-08-29)

Applicable tools (1)

This problem is linked from the tool pages below — reachable from either side.

python

Bundled solutions (combos)

This problem is part of the following verified bundles.

Source & evidence

Recorded Verified ✓ VerifiedApplies to 1 tool(s)
Entries contain locally measured or reviewable-source solutions; unmeasured items are explicitly labeled.

Source: https://stackoverflow.com/questions/39885520/why-does-ubuntu-show-python-command-not-found

← Coding Agents & Terminal domain | Problem Catalog Experience | Facing another issue? Go to the Helpdesk