Skip to content

Instantly share code, notes, and snippets.

@barbietunnie
Created June 18, 2022 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barbietunnie/694a3e10bd9bda90714cf995cb0b4725 to your computer and use it in GitHub Desktop.
Save barbietunnie/694a3e10bd9bda90714cf995cb0b4725 to your computer and use it in GitHub Desktop.
Ubuntu Notes

Ubuntu Notes

Install Python 2 on Ubuntu 20.04

sudo apt install python2

python2 -V

Easily switch from Python 2 to Python 3 or vice-versa on Ubuntu 20.04

  1. Check the python versions available on your Ubuntu system.
ls /usr/bin/python*
  1. Check if you already have some python alternatives configured.
sudo update-alternatives --list python
  1. Set the desired Python alternatives. In this example, we are setting Python2 and Python3 alternatives. Execute the following commands:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
  1. Confirm that the alternatives are ready to be used:
sudo update-alternatives --list python
  1. Change to the desired alternative python version.
sudo update-alternatives --config python
  1. Verify the new python version:
python -V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment