其他分享
首页 > 其他分享> > 16.04 – Gnome终端无法启动

16.04 – Gnome终端无法启动

作者:互联网

我只是尝试在我的Ubuntu 16.04系统上安装python 3.6,现在我无法从启动器或Ctrl Alt T运行终端.我试图从XTerm运行gnome-terminal并得到以下消息:

Traceback (most recent call last):
  File "/usr/bin/gnome-terminal", line 9, in <module>
    from gi.repository import GLib, Gio
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/gnome-terminal", line 9, in <module>
    from gi.repository import GLib, Gio
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'

我该如何解决这个错误?

还应该指出:

>我的gnome-terminal文件现在是一个python脚本.
> gnome-terminal.real文件将按预期打开终端.
> python3.5 gnome-terminal将按预期打开终端.

解决方法:

可能symlink /usr/bin/python3指向python3.6,它不应该.通过运行以下命令修复它:

sudo rm /usr/bin/python3
sudo ln -s python3.5 /usr/bin/python3

标签:gnome-terminal,python,gnome,16-04
来源: https://codeday.me/bug/20190807/1613599.html