If you come across the error message “zsh: command not found: python,” it means that either the Python executable is not in your shell’s PATH or it is not installed on your system.
This most likely to happen on systems using os version macOs 12.3 +. As they removed python support in macOS 12.3
Luckily, resolving this issue is a straightforward task. Follow these step-by-step instructions to fix this problem:
1. Check if Python is installed or not?
Make sure python is installed on your website. If it is not installed on your system then you can do this easily using the brew command on terminal.
brew install python
If you don’t know how to execute commands using the terminal or you are not comfortable using terminal then you can install the python using the executable file provided on python website. To download the python installable executable file visit python website.
2. Update Your Shell Profile:
The next step is to add
zsh so that it will run upon typing the
python command. You can do this by running the following in terminal:
echo "alias python=/usr/bin/python3" >> ~/.zshrc
3. Close and Restart Terminal
All set, Simply restart your terminal. When you open it again, your
python command should work successfully.
If you still find any difficulties to run the python command. Contact me using the comment box.