0

I'm trying to change my terminal's default python version to 3.9 from 3.8 and I think I broke something before since I tried to change the priority with sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 but still python --version yielded 3.8.10 and weirdly enough python3 --version yielded 3.8.2

I tried too lookup my alternatives with sudo update-alternatives --config python3

and got:

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.8   2         auto mode
  1            /usr/bin/python3.8   2         manual mode
* 2            /usr/bin/python3.9   1         manual mode

only when I explicitly wrote python3.9 it activated it, but still the default python command activated python 3.8.10 (and still weirdly enought python3 activated a different version).

I then tried to remove the 3.8 alternatives and successfully was left with 3.9 as the auto & manual and still got the same result, like something that I cannot seem to find has a higher/default priority over it.

Any help would be appreciated.

ImSo3K
  • 792
  • 7
  • 21
  • 1
    What's the output of `type python3` and if the binary is at a nonstandard location, how does it relate to whatever `/usr/bin/python3` points to? – tripleee Jul 05 '21 at 18:26
  • @tripleee it returns `python is /usr/local/bin/python`, I guess it's not what it supposed to return? – ImSo3K Jul 06 '21 at 06:13
  • 1
    Your locally installed `python` overrides the system version completely. If you uninstall it, the system will be back in charge; but we can't know how you installed it or why, so there may be complications around that. If you downloaded the Python sources and ran `make install`, you should simply be able to `make uninstall` in the same directory, provided of course you kept it on your system. Merely removing the binary will obviously leave multiple megabytes of unused support files on your system, so probably don't do that. – tripleee Jul 06 '21 at 07:46
  • @tripleee I tried it in that directory and got a `make: *** No rule to make target 'uninstall'. Stop.` message, for now I setup an alias for python & python3 to point to `/usr/bin/python3.9` while still researching how to uninstall that local installation. – ImSo3K Jul 06 '21 at 08:34
  • 1
    My bad - I simply assumed this would be implemented, but I see now that it isn't. See also https://stackoverflow.com/questions/3544378/uninstall-python-built-from-source ...If you have a well-managed installation, rebuilding your system might be a simpler way forward than figuring out how to manually remove all the chaff from an abandoned wanton source install. But perhaps leaving it around until you need to rebuild your OS for other reasons is good enough for now. Just be aware that you need to make sure you don't have dangling `PYTHONPATH` etc pointing to the stuff in `/usr/local`. – tripleee Jul 06 '21 at 08:52

0 Answers0