【发布时间】:2020-01-21 09:45:22
【问题描述】:
当我想切换到 python 3.8 时,我似乎破坏了我的 python 安装。使用 Ubuntu 18.04。尝试使用gi,会出现以下错误:
$ python
Python 3.8.1 (default, Dec 31 2019, 18:42:42)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GLib, Gio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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)
尝试为 python 运行 update-alternatives,但它告诉我只配置了一个 python 替代方案 (3.8)。
尝试重新安装 python3-gi 和 python3.8。还是一样的问题
【问题讨论】:
-
将
/usr/bin/python和python3符号链接恢复为python3.6很可能会为您解决此问题。这里真正的问题是:如何在不破坏一堆东西的情况下让 python 3.8 成为 Ubuntu 的默认版本?
标签: python python-3.x ubuntu