If you see zsh: command not found: python, it means Python isn't installed or isn't in your PATH.
Try this first:
python3
On modern Macs, Python 3 is installed but the command is python3, not python.
The Quick Fix
If python3 works but you want to type just python, create an alias:
echo 'alias python="python3"' >> ~/.zshrc
source ~/.zshrc
Now python runs Python 3.
If python3 Doesn't Work Either
Option 1: Install Xcode Command Line Tools
macOS comes with Python, but it requires developer tools:
xcode-select --install
Click "Install" in the dialog. After it finishes, try python3 again.
Option 2: Install Python with Homebrew
This gives you the latest Python version:
brew install python
If you don't have Homebrew:
/bin/bash -c "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installing, you'll have both python3 and pip3.
Option 3: Download from python.org
Go to python.org/downloads and download the installer.
After installing, add it to your PATH:
echo 'export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:\$PATH"' >> ~/.zshrc
source ~/.zshrc
Adjust the version number (3.12) to match what you installed.
Check Your Python Version
python3 --version
Output: Python 3.12.1 (or similar)
Why "python" Doesn't Work
Apple removed the default python command in macOS Monterey (12.3) because Python 2 is deprecated. You must now explicitly use python3.
This breaks old tutorials and scripts that use python. The fix is the alias shown above.
Set Up pip
pip is Python's package installer. On modern Macs, use pip3:
pip3 --version
If you want to type just pip:
echo 'alias pip="pip3"' >> ~/.zshrc
source ~/.zshrc
Create a Virtual Environment
Best practice is to use virtual environments for Python projects:
python3 -m venv myproject
source myproject/bin/activate
Inside the virtual environment, python and pip work without the 3.
Common Issues
"python3: command not found" after Homebrew install:
Add Homebrew's Python to your PATH. For Apple Silicon Macs:
echo 'export PATH="/opt/homebrew/bin:\$PATH"' >> ~/.zshrc
source ~/.zshrc
For Intel Macs:
echo 'export PATH="/usr/local/bin:\$PATH"' >> ~/.zshrc
source ~/.zshrc
Multiple Python versions:
Check which Python you're using:
which python3
This shows the path to the Python that runs.
Scripts still fail:
If a script has #!/usr/bin/env python at the top, change it to #!/usr/bin/env python3.
Keep Learning
Understanding PATH and how Mac finds commands helps you fix issues like this quickly. The free course covers these fundamentals.
Check it out at Mac Terminal for Humans.