【Ubuntu issues】ModuleNotFoundError: No module named ‘apt_pkg‘

Traceback (most recent call last):

File "/usr/lib/cnf-update-db", line 8, in <module>

from CommandNotFound.db.creator import DbCreator

File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>

import apt_pkg

ModuleNotFoundError: No module named 'apt_pkg'

This error is often caused by a mismatch between the Python version used by the system and the one required by the apt_pkg module.

复制代码
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --config python3
相关推荐
不能跑的代码不是好代码4 小时前
Linux系统常用命令中文速查表
linux·运维·服务器
石一峰6995 小时前
深入理解 Linux 中断三层机制与 1-Wire 时序锁原理
linux·运维·服务器
无限码农6 小时前
Linux上通过cmake编译uchardet
linux·运维·服务器
运维大师7 小时前
【Linux运维极简教程】06-网络配置与管理
linux·运维
探索云原生10 小时前
终于搞懂 Kueue:5 个核心对象一次讲透
linux·docker·ai·云原生·kubernetes
An_s10 小时前
机器学习python之识别图中物品信息
java·linux·开发语言
Championship.23.2411 小时前
Linux 3.0 LVDS驱动开发详解
linux·运维·驱动开发·lvds
风向决定发型丶12 小时前
Shell中的特殊变量
linux·运维·bash
mounter62512 小时前
走向长时运行:引入协程(Coroutines),打破 BPF 程序的“一堂到底”限制
linux·ebpf·kernel
运维大师13 小时前
【Linux运维极简教程】05-软件包管理
linux·运维·服务器