How to Change Default Python Version in Ubuntu - A Step-by-Step Guide for 2026
Prerequisites:
- Enable Windows Subsystem for Linux (WSL).
- Update WSL to WSL 2.
- Install Ubuntu 24.04 LTS Distro for WSL.
- Knowledge of Working in Terminal Environment.
You can download complete solution files that I have created in order to install the pyenv python library for changing between different python version. My provided solution contains Ubuntu environment shell script for installing & changing python version using pyenv library along with windows powershell script file for downloading the missing require certificates for pyenv python library installation.
5) In the Next step, execute the below set of command to copy the missing downloaded certificates into Ubuntu file system i.e.
7) Execute below command to check your Ubuntu system default python latest compatible version i.e.
- Globally: I don't recommend this option because it can interfere with Ubuntu environment core.
- Locally: With this you can change python version more specific to your project environment without any interference with the core environment.
- At Runtime: I highly recommend this option simply because this ensures that your python version has not permanently changed but only when needed and at the closure of the terminal everything resets back to default.
11) So to change python version at runtime using pyenv library, execute below set of command i.e.
12) Now check the python current version by executing below command. You will see that your desire python version is now in power i.e.
Conclusion
In this article, you will learn about the detail process of changing between compatible python versions within Ubuntu 24.04 system. You will learn about python library "pyenv" along with its installation process. You will also learn about the downloading process of the missing certificates require to install the pyenv library. Finally, you will learn to change python version at runtime without causing any errors & conflicts for the core Ubuntu environment operations along with what other options pyenv library supports for switching between different python versions.
Related Articles
- Learn to Install Windows Subsystem for Linux (WSL) in Windows
- Learn to Install Docker Desktop on Windows Drive D: and Fix WSL Errors
- Learn to Install Python IDE JupyterLab without Anaconda on Windows
- Step-by-Step Guide to Install Python on Windows without Anaconda
- Complete Guide to Install Python Chatbot RASA on Windows or Linux/Ubuntu










