How to Fix ""zsh: command not found: python" Error on MacOS X?
If you are receiving a "zsh: command not found: python" error on MacOS X, it means that the system cannot locate the Python installation.
Here are the steps you can follow to fix this error:
- Install Python using Homebrew:
brew install python
- If you already have Python installed, try updating it using Homebrew:
brew upgrade python
- Check if Python is installed properly by running the following command:
python --version
- If the above command gives an error, add the following line to your
.zshrc
file:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
You can edit the .zshrc
file using the following command:
nano ~/.zshrc
Save the changes and exit the file.
Run the following command to activate the changes:
source ~/.zshrc
- Verify that Python is working by running the following command:
python --version
You should not receive the "zsh: command not found: python" error anymore.