Debian – Make Python an Alias of Python3 Systemwide

aliasdebianpythonpython3

The latest updates of my Debian testing system removed Python version 2, and I only have Python 3 installed, with python3. There is no longer any command named python. This causes several scripts to fail, including scripts compatible with Python 3.

I would be interested in knowing what is the proper way to globally configure python as an alias for python3.

One dirty solution would be to manually do something like sudo ln -s /usr/bin/python{3,}, but I worry that this may not be robust to future APT updates (or if reinstalling Python 2 later). Another option is to set an alias, but then it would only work for my user, not for the entire system.

I also note that on Ubuntu there is a package python-is-python3 which does precisely this, but there is no such package on Debian.

Best Answer

It looks like Debian is now shipping python-is-python3 themselves (in sid and testing as of this writing), so the premise of the question no longer holds and you can just: sudo apt update && sudo apt install python-is-python3.

Related Question