You type python (or python3, or py) in a terminal and get command not found
(macOS/Linux) or 'python' is not recognized as an internal or external command
(Windows). Sometimes Windows opens the Microsoft Store instead of running anything.
Fresh laptop, first week of setup — or a machine where Python was installed but the terminal cannot see it. Most common on Windows right after running the python.org installer, and on macOS where the system ships an old Python under a different name. Linked module: 0.1 (Your machine, set up right).
The shell looks up commands in the folders listed in your PATH, in order. This error
means: no folder on the PATH contains a program with that exact name. Three causes
cover nearly every case. (1) Python is not installed at all. (2) Python is installed
but its folder was never added to the PATH — on Windows, the installer checkbox
"Add python.exe to PATH" was left unticked. (3) Python is installed under a different
name: python3 exists but python does not, or Windows wants py. Confirm which case
you are in: try all three names, then where python (Windows) or which -a python3
(macOS/Linux) to see what the PATH actually finds. On Windows, the Store opening means
a stub alias intercepted the name — real Python is still missing from the PATH.
Case 1: install Python 3.12+ from python.org; on Windows tick "Add python.exe to PATH"
on the first installer screen. Case 2: rerun the same installer, choose Modify, and
enable the PATH option — or add the install folder to PATH via
Settings → System → About → Advanced system settings → Environment Variables. Case 3:
use the name your system has (python3 or py) and move on; inside an activated
virtual environment the plain name python always works, which is one more reason to
use one. In every case: close the terminal completely and open a fresh one — open
terminals keep the old PATH and will keep failing after a correct fix.
Always tick the PATH checkbox on Windows installs. Verify immediately after any
install with python3 --version in a brand-new terminal. Work inside a virtual
environment so the interpreter name stops mattering. When helping a teammate, ask
"new terminal since the install?" before anything else — it resolves a third of
reports on its own.
Q: "A new joiner says Python is installed but the terminal says command not found.
Walk me through your diagnosis." Strong answer: explain PATH lookup in one sentence,
name the three causes in order of likelihood, give the confirming command
(where / which -a), and finish with the fresh-terminal detail — it signals you have
actually debugged this, not read about it.