All the Python developers are recommended to use a virtual environment for the applications. Which provides an isolated environment for the application with a defined Python version.

Switch Python Version on Ubuntu & Debian

The update-alternatives command-line tool is to create and maintain symbolic links for the default commands. With the help of this, we can easily switch commands to different versions. For, this tutorial, Python 3.10, and Python 2.7 are pre-installed on a Debian system. We will create a group for both commands and set symbolic links.

Conclusion

In this tutorial, you have learned about switching the default Python versions on your Ubuntu and Debian Linux systems. Instead of switching version you can also configure Python virtual environment for your applications.