Skip to content

Instantly share code, notes, and snippets.

@tiagocardosos
Last active August 26, 2019 14:37
Show Gist options
  • Save tiagocardosos/22c9025cb39ea7f4307357c077dd38ba to your computer and use it in GitHub Desktop.
Save tiagocardosos/22c9025cb39ea7f4307357c077dd38ba to your computer and use it in GitHub Desktop.
ubuntu - set default python

To change Python 3.6.8 as the default in Ubuntu 18.04 to Python 3.7.

Install Python 3.7

Steps to install Python3.7 and configure it as the default interpreter.

Install the python3.7 package using apt-get

sudo apt-get install python3.7

Add Python3.6 & Python 3.7 to update-alternatives

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

Update Python 3 to point to Python 3.7

sudo update-alternatives --config python3 Enter 2 for Python 3.7

Test the version of python

python3 --v Python 3.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment