Set default python version in Debian stretch
With both python
and python3
packages installed,
my Debian stretch systems seem to use python2.7 when /usr/bin/python is executed.
I prefer python3 as a default, as python2 is IMHO somewhat deprecated
and I try to avoid it whenever I can.
Therefore, I was surprised that update-alternatives --config python
resulted in an error message:
update-alternatives: error: no alternatives for python
However, this is easily fixed by manually installing alternative entries:
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
A higher number specifies a higher priority, which in this case results in python3
being the default from now on.