【问题标题】:Docker Installation: ImportError: cannot import name '_gi' from 'gi' (/usr/lib/python3/dist-packages/gi/__init__.py)Docker 安装:ImportError: cannot import name '_gi' from 'gi' (/usr/lib/python3/dist-packages/gi/__init__.py)
【发布时间】:2020-08-24 13:07:07
【问题描述】:

使用本教程 install docker ubuntu 18.04 将 Docker 存储库添加到 APT 源以在 ubuntu 18.04 中安装 docker 时出现以下错误:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
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 67, 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 'gi' (/usr/lib/python3/dist-packages/gi/__init__.py)

尝试将 python 版本从 3.7 更改为 3.6,但没有成功。任何帮助将不胜感激。

谢谢。

【问题讨论】:

  • 这能回答你的问题吗? Cannot import name '_gi'
  • 嘿,试过了。 Din;t 为我工作
  • 使用了其中一个 cmets 的答案。工作。谢谢

标签: docker docker-compose dockerfile docker-machine


【解决方案1】:

在python3.7中使用此命令Source

sudo ln -s /usr/lib/python3/dist-packages/gi/_gi.cpython-{36m,37m}-x86_64-linux-gnu.so

【讨论】:

    猜你喜欢
    • 2022-08-16
    • 2022-12-01
    • 1970-01-01
    • 2022-06-16
    • 2022-01-22
    • 2022-08-20
    • 2022-12-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多