如何以正确的方式更新python?

如何以正确的方式更新python?

我曾经毫无问题地更新过我的 Python 版本,但我确实注意到,由于未知原因,当我使用“sudo update-alternatives --config python3”更改我的 Python 版本时,我的操作系统无法正常工作

我确实有其他选择:

$ 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

如果我不选择python3.8版本,一些系统命令和应用程序将无法运行;

例如,当我将 py 3.9 设置为默认值并尝试运行系统 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)

任何关于如何修复它的帮助都将非常受欢迎!问候,莱昂纳多

相关内容