The update-alternatives Linux command can be used to update the default version of Python.

Example: Use Python 3.7

sudo update-alternatives --set python /usr/bin/python3.7

Example: Use Python 3.8

sudo update-alternatives --set python /usr/bin/python3.8

Example: Use Python 3.9

sudo update-alternatives --set python /usr/bin/python3.9

Example: Use Python 3.10

sudo update-alternatives --set python /usr/bin/python3.10

Persist version forever

If you want to set Python version forever, please use the following command to update your .profile file:

echo "sudo update-alternatives --set python /usr/bin/python3.8" >> ~/.profile

<aside> ℹ️ Please, let us know if some essentials are missing. Join our Discord Community to discuss new ideas and features.

</aside>