损坏的终端、终结器和 apt

损坏的终端、终结器和 apt

我有一个 Ubuntu 18.LTS,不小心触发了

update-alternatives --config python3.6

这似乎已经破坏了我的系统,因为现在终端、终结器和 apt 似乎都无法正常工作

终结者

Traceback (most recent call last):
  File "/usr/bin/terminator", line 23, in <module>
    import psutil
ModuleNotFoundError: No module named 'psutil'

终端

Traceback (most recent call last):
  File "/usr/bin/gnome-terminal", line 9, in <module>
    from gi.repository import GLib, Gio
ModuleNotFoundError: No module named 'gi'

易于

例如尝试添加存储库(仅尝试安装 3.5,因为它似乎是所有这些程序使用的默认版本)

 internetmosquito@internetmosquito-PE72-7RD  ~  sudo add-apt-repository ppa:deadsnakes/ppa
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 12, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ModuleNotFoundError: No module named 'softwareproperties'

现在,我必须说我有使用 pyenv 安装的不同版本的 Python:

 ✘ internetmosquito@internetmosquito-PE72-7RD  ~  pyenv versions
  system
  2.7.13
* 3.8.3 (set by /home/internetmosquito/.pyenv/version)
  3.9-dev

其中大部分安装在 /home/internetmosquito/.pyenv/versions

 internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /home/internetmosquito/.pyenv/versions
total 20
drwxr-xr-x  6 internetmosquito internetmosquito 4096 jun 13  2020 3.9-dev
drwxr-xr-x  6 internetmosquito internetmosquito 4096 jun 16  2020 3.8.3
drwxrwxr-x 13 internetmosquito internetmosquito 4096 sep 27 20:35 ..
drwxr-xr-x  6 internetmosquito internetmosquito 4096 feb  9 01:05 2.7.13
drwxr-xr-x  5 internetmosquito internetmosquito 4096 feb  9 02:12 .

现在如果我检查 /usr/bin/python 我会看到以下内容

internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /usr/bin/python*
lrwxrwxrwx 1 root root      16 mar 13  2020 /usr/bin/python3-config -> python3.8-config
lrwxrwxrwx 1 root root       9 mar 13  2020 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root     388 mar 28  2020 /usr/bin/python3-pasteurize
-rwxr-xr-x 1 root root     384 mar 28  2020 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     152 abr  9  2020 /usr/bin/python3-pbr
lrwxrwxrwx 1 root root      33 jul 28  2020 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
-rwxr-xr-x 1 root root 5486352 jul 28  2020 /usr/bin/python3.8
-rwxr-xr-x 1 root root 3629032 ago  4  2020 /usr/bin/python2.7
lrwxrwxrwx 1 root root      25 feb  8 23:49 /usr/bin/python3 -> /etc/alternatives/python3
lrwxrwxrwx 1 root root      24 feb  9 00:50 /usr/bin/python -> /etc/alternatives/python

似乎我没有 Python 3.5,“我认为”它是终结者所使用的......

 internetmosquito@internetmosquito-PE72-7RD  ~  cat /usr/bin/terminator 
#!/usr/bin/python3

而我的 python3 解析实际上与我的 python 相同......

internetmosquito@internetmosquito-PE72-7RD  ~  python
Python 3.8.3 (default, Jun 16 2020, 18:30:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
 internetmosquito@internetmosquito-PE72-7RD  ~  python3
Python 3.8.3 (default, Jun 16 2020, 18:30:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

如果我再次尝试更新替代方案,我会收到此消息...

internetmosquito@internetmosquito-PE72-7RD  ~  sudo update-alternatives --config python3 There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/local/bin/python3.7 Nothing to configure.

甚至不确定为什么它提到了 python3.7?我确实在 /usr/local/bin 中看到了几个 python

✘ internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /usr/local/bin/python*
lrwxrwxrwx 1 root root       17 dic 24  2018 /usr/local/bin/python3.7-config -> python3.7m-config
-rwxr-xr-x 2 root root 14925232 dic 24  2018 /usr/local/bin/python3.7m
-rwxr-xr-x 2 root root 14925232 dic 24  2018 /usr/local/bin/python3.7
-rwxr-xr-x 1 root root     3097 dic 24  2018 /usr/local/bin/python3.7m-config
-rwxr-xr-x 2 root root 14642520 feb  9 00:46 /usr/local/bin/python3.5m
-rwxr-xr-x 2 root root 14642520 feb  9 00:46 /usr/local/bin/python3.5
-rwxr-xr-x 1 root root     3071 feb  9 00:46 /usr/local/bin/python3.5m-config
lrwxrwxrwx 1 root root       17 feb  9 00:46 /usr/local/bin/python3.5-config -> python3.5m-config
lrwxrwxrwx 1 root root        9 feb  9 00:46 /usr/local/bin/python3 -> python3.5
lrwxrwxrwx 1 root root       16 feb  9 00:46 /usr/local/bin/python3-config -> python3.5-config

除此之外 lsb_release 也不起作用!

 internetmosquito@internetmosquito-PE72-7RD  ~  lsb_release -a                 
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

甚至不知道还有多少东西坏了……有什么建议可以让系统恢复正常,而不需要重新安装 Ubuntu?我试过了但没用..与上面描述的问题相同

谢谢!

相关内容