You have two main options to make the python command work, and I recommend Option 1 as the cleanest modern solution.
Option 1: Use python3 (Recommended)
The most straightforward and modern way is to always use python3 in your command line.
-
To run a script:
python3 your_script.py -
To enter the interpreter:
python3This is the current best practice for Python development.
Option 2: Create a Shell Alias
If you really prefer typing python, you can tell your shell (Zsh) to treat the command python as python3.
-
Open your Zsh configuration file (
.zshrc):nano ~/.zshrc -
Add the following line to the end of the file:
alias python='python3' -
Save and close the file (press
Control-X, thenY, thenEnter). -
Reload your shell configuration to apply the change:
source ~/.zshrc
Now, when you type python, your system will actually execute python3.