0

Im new to linux and im struggling with the alternative install management for python. I managed to change the default python versions for sudo and root (if i understand it correctly). However i would like to change the default versions of root and sudo for python3 as well, since thats what im installing my venvs with.

Any ideas on how to fix this, are highly appreciated :) enter image description here

1 Answers1

0

python3 is usually just a symlink to another executable. You can get the location with whereis python3, it's the first entry. For me, its /usr/bin/python3. It seems like for you, it's different for your user and for root, so execute whereis using sudo and without.

ls -l /usr/bin/python3 shows you the the target of that symlink. For me, it's this: lrwxrwxrwx 1 root root 9 Dec 13 12:55 /usr/bin/python3 -> python3.9

The target is the file python3.9, also residing in /usr/bin. For you, it's likely to be python3.6.

You can change the version by replacing the target of that symlink. To verify the name of the correct target, check ls -Al /usr/bin | grep python.

cd /usr/bin
sudo ln -f -s python3.9 python3

If the owner of the python3 symlink is your user, omit sudo.

maddingl
  • 594