Symlink to switch between SW versions

I was building Node.js v16 which uses a fork of GYP (meta-build tool written in python). The setup script contains the shebang ‘#!/usr/bin/env python3’. The binary /usr/bin/env executes the first python3 found based on $PATH.

/usr/bin$ env | grep PATH
...
PATH=/home/user/bin: ... :/usr/local/bin: ... :/usr/bin: ...
...
/usr/bin$ env python3 --version
Python 3.5

But the required python versions are 3.6, 3.7, 3.8, 3.9, or 3.10. The issue with python is that it’s non backward compatible. Therefore it’s nice to switch between versions directly on the running system with only redirecting the symlink.

/usr/bin$ sudo apt install python3.10
...
/usr/bin$ ls -l | grep python3
...
... python3 -> python3.5
... python3.5
... python3.10
...
/usr/bin$ sudo ln -sfn python3.10 python3
/usr/bin$ ls -l | grep python3
...
... python3 -> python3.10
... python3.5
... python3.10
...