iTranslated by AI
How to run python3 with the python command on macOS
Introduction
After installing python3 on macOS, running the python command resulted in an error.
python -v
zsh: command not found: python
This is because the python command is not linked to python3.
Therefore, you correctly need to run the python3 command as shown below.
python3 -v
However, typing python3 every time is a bit of a hassle.
So, in this article, I will show you how to enable the python command to execute python3.
Solution
You can solve this by following these steps.
1. Check the path
First, check where python3 is installed.
which python3
/opt/homebrew/bin/python3
2. Create a symbolic link
Create a symbolic link named python pointing to python3.
ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python
3. Verification
Run the python command to verify that python3 is executed.
python -v
Python 3.12.3
Now, you can execute python3 using the python command.
Summary
In this article, I introduced how to make the python command execute python3.
If you use python3 frequently, please give this method a try.
Discussion