Categories
Python Answers

How to change the default Python version?

Spread the love

Sometimes, we want to change the default Python version.

In this article, we’ll look at how to change the default Python version.

How to change the default Python version?

To change the default Python version, we can add the alias for python in the bash_profile file in the home directory.

We run

which python3

to get the directory of python3.

Then we open bash_profile and add the alias for python with

alias python='/usr/local/bin/python3'

Then we reload bash profile with

source ~/.bash_profile

Then we check the Python version with

python --version

Conclusion

To change the default Python version, we can add the alias for python in the bash_profile file in the home directory.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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