fuckingpython.lol

Python errors › Shell

zsh: command not found: python

Updated

"zsh: command not found: python" is a Mac shell error: there is no command called python, only python3. Why macOS has no python command, and three fixes.

What you see

% python main.py
zsh: command not found: python

What it means

The shell looked for a program called python in every folder on your PATH and found none. Python may well be installed: on a Mac it is called python3.

macOS shipped Python 2.7 as /usr/bin/python for years. Apple removed it in macOS Monterey 12.3, and nothing took the unversioned name. What a Mac has now is /usr/bin/python3, which runs the Python 3 that comes with Apple's command line developer tools and offers to install them the first time, plus whatever you installed yourself. The python.org installer and Homebrew both add python3, not python.

Why it happens

  • A tutorial or script that says python, written for Windows, for Linux distributions that provide the name, or for a virtual environment.
  • No virtual environment is active. Inside an activated venv, python exists and points at that environment's interpreter.

How to fix it

Type python3 instead, and pip3 or python3 -m pip for pip:

python3 main.py
python3 -m pip install requests

To make python work in your own terminal, add an alias to ~/.zshrc and open a new terminal window:

echo 'alias python=python3' >> ~/.zshrc

For a project, create and activate a virtual environment; it provides python and pip for as long as it is active:

python3 -m venv .venv
source .venv/bin/activate
python main.py

With Homebrew's Python, unversioned python and pip links are in the formula's libexec/bin folder, which you can put on your PATH; brew info python prints the exact path.

Questions

Should I install Python 2 to get the old command back?

No. Python 2 reached its end of life on 1 January 2020 and gets no security fixes. Point the scripts at python3.

Will the alias work in scripts?

No. Aliases apply to the interactive shell only. In a script, write python3, or #!/usr/bin/env python3 as its first line.

Sources

Read on October 25, 2026.