If you have multiple Python versions installed on your Ubuntu system, you can configure which one is used by default.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KarChunT/karchunt.com/llms.txt
Use this file to discover all available pages before exploring further.
Set the Default Python Version
First, check the installed Python versions on your system and copy the path to the version you want to set as default.
# copy the path to your python version
whereis python3.13 # replace your version with the one you want to set as default
Use the
update-alternatives command to register your Python version. The higher the priority value, the higher the priority of that version.sudo update-alternatives --install /usr/bin/python3 python3 <replace-your-path> <priority-value>
# example
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1
sudo update-alternatives --config python3 # select the version you want to set as default
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/local/bin/python3.12 2 auto mode
1 /usr/bin/python3.13 1 manual mode
2 /usr/local/bin/python3.12 2 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1