
Press to keep the current choice, or type selection number:ĭepending on the Python version we want to be the default, we select a number shown and then click on the enter key. * 0 /usr/local/bin/python3.11 20 auto mode

There are 2 choices for the alternative python (providing /usr/bin/python). $ sudo update-alternatives -config python $ sudo update-alternatives -install /usr/bin/python python /usr/local/bin/python3.11 20 We should note that flags with higher priority numbers have higher precedence in automatic mode: We’ll use the update-alternatives command following this syntax: $ sudo update-alternatives -install needs Next, suppose we want the Python in /usr/local/bin/python3.11 set as the default. Python: /usr/bin/python3.5-config /usr/bin/python3.5m-config /usr/bin/python2.7 /usr/bin/python3.5 /usr/bin/python3.5m /usr/bin/python /usr/lib/python2.7 /usr/lib/python3.5 /etc/python2.7 /etc/python3.5 /etc/python /usr/local/bin/python3.11-config /usr/local/bin/python3.11 /usr/local/lib/python2.7 /usr/local/lib/python3.5 /usr/local/lib/python3.11 /usr/include/python3.5 /usr/include/python3.5m /usr/share/python /usr/share/man/man1/python.1.gz

For instance, let’s assume these are the versions we currently have: $ whereis python Let’s say we’ve got several versions of Python installed. We use this command to maintain symbolic links determining default commands. Now, we’ll look at how we can set the default Python version to whatever version we want using the update-alternatives command.
