在 Ubuntu 20.04.3 sudo su 或任何其他命令不起作用
In Ubuntu 20.04.3 sudo su or any other command not working
yashm@yashm-Inspiron-15-3567:~$ sudo su
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
我自己找到了解决方法
由于 sudo 命令不起作用,您必须事先安装 synaptic 包管理器
搜索 python3-apt 将其标记为完全删除并完全重新安装一切都会再次正常
参考:https://www.datasciencelearner.com/importerror-no-module-named-apt_pkg-fix/
yashm@yashm-Inspiron-15-3567:~$ sudo su
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
我自己找到了解决方法 由于 sudo 命令不起作用,您必须事先安装 synaptic 包管理器 搜索 python3-apt 将其标记为完全删除并完全重新安装一切都会再次正常 参考:https://www.datasciencelearner.com/importerror-no-module-named-apt_pkg-fix/