Many applications I use (arandr, inkscape, ...) get broken when default Python version is set to Python-3 by update-alternatives --config python.

How can I prevent myself from setting default Python version to Python-3 in the future, like we do for /etc/resolv.conf by chattr +i /etc/resolv.conf?

  • 2
    Which version of Debian are you using? The Python packages in Debian don’t use alternatives, so the fact that you have a python alternative suggests that you’ve already messed up your installation, before even getting as far as update-alternatives --config python and choosing python3. Feb 14, 2021 at 20:23
  • Weird, I found that python isn't using update-alternatives anymore when I answered a similar question earlier this week. unix.stackexchange.com/a/633550/272848
    – Stewart
    Feb 14, 2021 at 20:45
  • @StephenKitt I'm using Debian Buster. I remember that I intentionally registered the Python versions some time ago, while chasing some kind of issue.
    – ceremcem
    Feb 14, 2021 at 21:24
  • @Stewart in Debian, the Python packages stopped using alternatives in 2001 IIRC. The change is more recent in Ubuntu. Feb 14, 2021 at 21:49
  • @ceremcem oh I’ve no doubt it was intentional and with the best of intentions. My point is that you’re asking for help protecting yourself from a sub-optimal setup in the first place; it would be better IMO to revert to the standard setup instead, but explaining how to do that would require knowing what you did. Feb 14, 2021 at 21:51

1 Answer 1


How can I prevent myself from setting default Python version to Python-3 in the future

Remove python versions from update-alternatives:

sudo update-alternatives --remove-all python

In the future the following command

sudo update-alternatives --config python

will show you:

update-alternatives: error: no alternatives for python3 
  • That won't make me stop, because if I'm instructed to "set the Python version to Python-3" I'll re-register the Python versions (as currently registered Python versions are registered by me, some time ago, while chasing a problem). Can I safely register the path of Python3 version to something like "/do/not/select/this"?
    – ceremcem
    Feb 14, 2021 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .