1. Questions
homebrew installs python with the following command
brew install python3
Then use the following command to view the installed version of python
python --version
There will be an error:
zsh: command not found: python
2. Solutions
2.1 Add python to zsh
Added python
to zsh so it python
runs when a command is typed. This can be done by running the following command in Terminal:
echo "alias python=/usr/bin/python3" >> ~/.zshrc
This configures your zsh profile to run at
/usr/bin/python3
runtimepython
. If you're still having trouble, make surepython=$
the $ sign should be equal topython
where your installation path is
2.2 Restart the terminal
Or enter the following command:
source ~/.zshrc
At this point, python
the command should run successfully.
~> python --version
Python 3.8.9
Reference link: How to fix 'zsh: command not found: python'