Ubuntu16.04LTS自带python27和Python35,我就自做聪明的按照网上教程把更新了python36版本,并把原来自带指向python27也改为指向python36,结果就悲剧了,引发了一系列问题,比如terminal打不开,无法打开设置中的 language support 和 software & updates,不能更换中文输入法,不能安装英伟达显卡驱动等等。这些问题只能一个一个解决了,关于终端打不开的问题(终端打不开了,点击图标显示正在打开但并不能打开,使用Ctrl+alt+T也打不开)按照以下步骤即可解决:

解决思路如下:

先找到能打开的shell来寻找错误,于是用Ctrl+Alt+F1进入命令行模式,

登录账号密码后进入正常的命令行, 查找终端的问题:

gnome-terminal

报以下错误:

Traceback (most recent call last):
File “/usr/bin/gnome-terminal”, line 9, in 
from gi.repository import GLib, Gio
File “/usr/lib/python3/dist-packages/gi/init.py”, line 42, in 
from . import _gi
ImportError: cannot import name ‘_gi’

 

 

度娘了ImportError: cannot import name '_gi’后找到第二个帖子,发现可能是装Python时遗留下来的问题

进入路径:

cd /usr/lib/python3/dist-packages/gi/

使用 ls 可以看到此路径下所有的文件,其中的两个:

_gi_cairo.cpython-35m-x86_64-linux-g 和 _gi.cpython-35m-x86_64-linux-gnu.so

需要重命名,分别把35改成36。重命名:sudo mv 源文件名  新改文件名,即如下命令:

sudo mv _gi_cairo.cpython-35m-x86_64-linux-g _gi_cairo.cpython-36m-x86_64-linux-g
sudo mv _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-36m-x86_64-linux-gnu.so

这样修改之后,按Ctrl+Alt+F7就可以从命令模式切换到图形界面,然后正常打开terminal啦。

 

 

GitHub 加速计划 / term / terminal
94.53 K
8.17 K
下载
The new Windows Terminal and the original Windows console host, all in the same place!
最近提交(Master分支:26 天前 )
bc6f3e22 The underlying issue is that the "Pane" is used both as a model and as a UI element and so a pane loses its content as soon as it is closed, but the tree only gets reordered after the animation has finished. This PR is truly just a hotfix, because it doesn't solve this issue, it only adds checks to the function that crashes. Closes #17869 Closes #17871 ## Validation Steps Performed * `Split pane` a few times * Run the "Close all other panes" action * Doesn't crash ✅ 6 天前
6196a3d0 7 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐