How to Fix ""zsh: command not found: python" Error on MacOS X?

python

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:

  1. Install Python using Homebrew:
brew install python
  1. If you already have Python installed, try updating it using Homebrew:
brew upgrade python
  1. Check if Python is installed properly by running the following command:
python --version
  1. 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
  1. Save the changes and exit the file.

  2. Run the following command to activate the changes:

source ~/.zshrc
  1. Verify that Python is working by running the following command:
python --version

You should not receive the "zsh: command not found: python" error anymore.

Latest Questions

python How to Fix ""zsh: command not found: python" Error on MacOS X? python How to Fix "xlrd.biffh.XLRDError: Excel xlsx file; not supported" Error in Pandas? python How to Remove All Whitespace From a Python String?