How To Make Python Command Point to Python3

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:

alias python=python3

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:

python --version 

You should see the version number of Python 3 printed on the screen.

Processing…
Success! You're on the list.

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.