我将我的 python 从 3.6 升级到 3.7.1 从那以后我无法打开我的 GNOME 终端。我重新安装了gnome终端。使用命令
sudo apt-get remove gnome-terminal && sudo apt-get install gnome-terminal
但它没有打开。Ctrl+ Alt+T也不能正常工作。
我打开 Xterm 并输入“gnome-terminal”。
我收到这个错误
Cannot import name '_gi' from 'gi'(/usr/lib/python3/dist-packages/gi/__init__.py)
错误截图:
的输出ls -l /usr/bin/python3
:
ls: cannot access '/usr/bin/python3': No such file or directory
我也在apt
命令中收到错误:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up iotop (0.6-2) ... /var/lib/dpkg/info/iotop.postinst: 6: /var/lib/dpkg/info/iotop.postinst: py3compile: not found dpkg: error processing package iotop (--configure): installed iotop package post-installation script subprocess returned error exit status 127
Errors were encountered while processing: iotop
E: Sub-process /usr/bin/dpkg returned an error code (1)
通过更新替代方案,即使在python
被调用时,您也已将 Python 3 设置为默认值。这可能会破坏一些包。因此,就 Python 而言,最好使用别名。回滚您所做的更改:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2
sudo update-alternatives --config python
并选择python2。python
总是用来调用 Python 2 和python3
调用 Python 3。
GNOME 终端依赖于 Python 3 的默认版本(这里是 3.6)。在您的安装中,GNOME 终端试图与 Python 2 一起运行,这显然无法满足其依赖性。因此,修改的第一行/usr/bin/gnome-terminal
并将其更改为:
#!/usr/bin/python3
现在,在您的安装中,python3 不在 /usr/bin/ 中,也找不到 py3compile,可以通过重新安装 python3-minimal 来恢复它们:
sudo apt install --reinstall python3-minimal
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句