You may find that typing “python” in the terminal or command prompt gives an error ‘python’ not found.
if you want to use Python 3 as your default Python version, you can make the “python” command point to Python 3 by following the steps below.
Create an alias
An alias is a shortcut that lets you use a different command name to run an existing command. You can create an alias for the “python” command that points to Python 3 by typing the following command in the terminal:
This creates an alias for the “python” command that runs the “python3” executable instead. To make this change permanent, you can add the “alias python=python3” line to your shell profile file (e.g., ~/.bash_profile, ~/.bashrc, or ~/.zshrc).
To verify that the alias works, type the following command in the terminal:
You should see the version number of Python 3 printed on the screen.
Leave a Reply