Score:0

How to update python in the correct way?

mx flag

I have ever updated my python version without problem but I did note that for an unknown reason my OS is not working well when I do change my python version using `sudo update-alternatives --config python3`

I do have the alternatives:

$ sudo update-alternatives --config python3
There are 3 choices for the alternative python3 (providing /usr/bin/python3).

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

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/python3.10 to provide /usr/bin/python3 (python3) in manual mode

If I don't choose python3.8 version some system commands and apps will not work;

For example when I set the py 3.9 as default and tried to run a system cmd:

$ sudo add-apt-repository ppa:deadsnakes/ppa
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 12, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 68, in <module>
    from gi.repository import Gio
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gi/__init__.py)

Any help on how to fix it will be very welcome! REgards, Leonardo

David avatar
cn flag
Changing the default version kills many features of the OS and should never be done. Each version has a particular version that MUST be used.
mx flag
hummm... I never heard about this... So how should I proceed? Depending on what I want to do a need to change the default python version?
David avatar
cn flag
A search of the site would have given you dozens if not hundreds of questions warning of this. You never change the DEFAULT.
mx flag
I read dozens of tutorials about updating the python version and in no one of them they did mention about this
hu flag
You install a new version locally, and use it, without changing the default version. It is not an update, becasuse "update python" will break things.
mx flag
perfect @mikewhatever... Thank you very much
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.