Home » How To » How to Change the Python Default Version in Ubuntu

How to Change the Python Default Version in Ubuntu

In this tutorial, we will learn How to Change the Python Default Version in Ubuntu?

By default python on mostly Ubuntu, there is Python 2. We need to use Python 3 to run the python files with the latest version.

After research, I am come up with an easy solution to set Python3 as a default on the Ubuntu system.

Steps to Set Python3 as Default On Ubuntu

  • Check python version on terminal –
    python --version
  • Get root user privileges. On terminal type –
    sudo su
  • Write down the root user password.
  • Execute this command to switch to python 3.9.
    update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  • Check Python version –
    python --version
  • All Done! Now you can use “python” instead of “python3” for your latest Python3.x version on Ubuntu🤓

Leave a Comment