Homebrew Python Not Found

Published
Updated

This is a huge annoyance of mine. When you install Python using Homebrew, the install script doesn’t configure your PATH to accommodate the version-less symlinks and aliases created, resulting in the notorious error:

zsh: python: command not found
zsh: pip: command not found

In short, python3 and pip3 work but python and pip will not!

How to fix ‘python command not found’

First create and copy the symlink location by running the following:

brew link python

That will return something like the following:

Homebrew - Brew Link Python path (homebrew python not found)

Note:I use an M1/M2 Mac. If you are using an Intel Mac, your path will start with /usr/local/

Copy the path that is returned, then open your ~/.zshrc file ~/.bashrc if you use bash:

nano ~/.zshrc

You can then add an export PATH line at the top or bottom of your file with your appropriate Python version like so:

export PATH=/opt/homebrew/opt/python@3.10/libexec/bin:$PATH

Save it and then open a new terminal, your python command will now work as expected!