$ sudo update-alternatives -install /usr/bin/python python /usr/bin/python3 2 Configure Python Alternatives $ sudo update-alternatives -install /usr/bin/python python /usr/bin/python2 1 From the image in Step 2 above, we saw that I have Python 2.7 and Python 3.8 present on my system.Įxecute the commands below on the Terminal. Step 3) Now, we will configure two Python alternatives. sudo update-alternatives -list python Check for any Python alternatives configured on the systemįrom the image above, we see that there are no Python alternatives configured. Step 2) Once we have listed all the versions present on the system, we need to check whether there are any Python-alternatives configured.Įxecute the command below on the Terminal. ls /usr/bin/python* Check all the installed Python versions in the bin directory In such situations, the –version command won’t be useful as it only lists the currently configured version.Įxecute the commands below on the Terminal. That is because we can have variations in Python 3. To do so, we will need to check the /bin directory. Step 1) Check all the available Python versions in your system. How to switch between Python 2 and 3 versions on Ubuntu 20.04 Method 1: My recommended way by configuring Now, let’s jump on to one of the important parts of this tutorial of how to configure Python and switch between the two versions – Python 2 and Python 3. From the image above, we can see we are running Python 2.7 and Python 3.8.