After installing Python 2 via Homebrew, how do I ensure the 'python2' command works?

Responsive Ad Header

Question

Grade: Education Subject: Support
After installing Python 2 via Homebrew, how do I ensure the 'python2' command works?
Asked by:
84 Viewed 84 Answers

Answer (84)

Best Answer
(277)
After `brew install python@2`, you usually need to source your shell configuration file. If you use Zsh (default on newer macOS), run `source ~/.zshrc`. If you use Bash, run `source ~/.bash_profile`. This reloads your shell with the updated PATH, making `python2` discoverable.