Set Python version with update-alternatives

Python users typically use a non-system Python distribution such as Miniconda. Python distributions typically allow easy switching of Python version. Where Linux system Python must be used, the default Python version can be switched persistently with update-alternatives.

Update-alternatives without sudo: a one-time setup.

Configure shell to use ~/.local/bin instead of system-wide /usr as follows:

mkdir ~/.local/bin

Add to ~/.profile:

export PATH="$HOME/.local/bin:$PATH"

Enable switching Python default between Python versions with these one-time commands:

update-alternatives --install $HOME/.local/bin/python python /usr/bin/python3 20

After the setup above, at any time select the default system Python version without sudo:

update-alternatives --config python