Ubuntu启动不了Terminal

Ubuntu启动不了Terminal

本机原本使用Python3.10,切换Python3.8之后,终端启动不了。

问题确认是否是切换Python版本导致

在vscode终端或者tty模式输入sudo gnome-terminal,会有报错信息:

bash 复制代码
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, 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)

或者直接journalctl -xe | grep -i python,查看是否是ImportError: cannot import name '_gi' from 'gi'导致的,如果是就需要进行下面操作。

解决方法

  1. 恢复系统版本Python
  2. 修改gnome terminal 的 shebang 行:修改/usr/bin/gnome-terminal文件的第一行:
python 复制代码
#!/usr/bin/python3.10
相关推荐
上学的小垃圾12 小时前
基于docker安装MySQL(openEuler系统)
linux·mysql·docker·容器
一直C13 小时前
Linux网络编程|HTTP协议详解(报文、请求方法、状态码)
linux·http·wireshark·vim·visual studio
Brilliantwxx16 小时前
【Linux】 进程(10) 进程控制深度解析:创建、终止与等待
linux·运维·服务器·c语言·开发语言·网络
欧米欧16 小时前
Linux基础指令上
linux·运维·服务器
ARM|X86+FPGA工业主板厂家17 小时前
基于嵌入式 GPU 的智能服务机器人
linux·运维·arm开发·fpga开发·机器人
sulikey18 小时前
Linux 粘滞位(Sticky Bit)完全指南:为什么共享目录需要“防删除“?
linux·服务器
mengge.cloud18 小时前
网络技术基础小白教程
linux·服务器·网络·云计算
学代码的CJY18 小时前
Linux 重定向、管道与环境变量
linux·spring boot·spring
treacle田18 小时前
达梦数据库-Linux DM数据守护主备集群缩改为单机-记录总结
linux·服务器·数据库·主备集群改单机
IT大白鼠19 小时前
CentOS 7.9 自建 Yum 源服务器搭建指南
linux·服务器·centos