ModuleNotFoundError: 'apt_pkg'라는 모듈이 없습니다.

ModuleNotFoundError: 'apt_pkg'라는 모듈이 없습니다.

설치되지 않은 다양한 명령이나 패키지를 사용하려고 하면 다음 오류 메시지가 나타납니다.

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 apt autoremove하지만 , sudo apt autoclean또는 를 사용하면 sudo apt remove python3-apt다음과 같은 오류 메시지가 나타납니다.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apt-xapian-index : Depends: python3-apt (>= 0.7.93.2) but it is not going to be installed
 debtags : Depends: python3-apt but it is not going to be installed
 gjs : Depends: libgjs0g (= 1.72.0-3~ubuntu22.04.1) but 1.68.4-1 is to be installed
 language-selector-common : Depends: python3-apt (>= 0.7.12.0) but it is not going to be installed
 language-selector-gnome : Depends: python3-apt but it is not going to be installed
 libgirepository-1.0-1 : Depends: libglib2.0-0 (>= 2.70.0) but 2.68.4-1ubuntu1 is to be installed
                         Breaks: libgjs0g (< 1.68.4-1+b1) but 1.68.4-1 is to be installed
 libpython3.10-stdlib : Breaks: python3-gdbm (< 3.9.9-1~) but 3.9.7-1 is to be installed
 obs-studio : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-apport : Depends: python3-apt (>= 0.7.9) but it is not going to be installed
 python3-aptdaemon : Depends: python3-apt (>= 0.8.5~ubuntu1) but it is not going to be installed
 python3-brlapi : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-cairo : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-cffi-backend : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-commandnotfound : Depends: python3-apt but it is not going to be installed
 python3-cups : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-dbus : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-dev : Depends: python3 (= 3.10.4-0ubuntu2) but 3.9.4-1build1 is to be installed
 python3-distutils : Depends: python3:any (>= 3.10.1-0~)
                     Depends: python3-lib2to3 (= 3.10.4-0ubuntu1) but 3.9.7-1 is to be installed
 python3-evdev : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-gi : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-gi-cairo : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is to be installed
 python3-software-properties : Depends: python3-apt (>= 0.6.20ubuntu16) but it is not going to be installed
                               Recommends: unattended-upgrades but it is not going to be installed
 ubuntu-advantage-tools : Depends: python3-apt but it is not going to be installed
 ubuntu-drivers-common : Depends: python3-apt but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

시도해 보니 apt --fix-broken install작동하지 않고 다음과 같은 오류 메시지가 나타납니다.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 gjs : Depends: libgjs0g (= 1.72.0-3~ubuntu22.04.1) but 1.68.4-1 is installed
 libgirepository-1.0-1 : Depends: libglib2.0-0 (>= 2.70.0) but 2.68.4-1ubuntu1 is installed
                         Breaks: libgjs0g (< 1.68.4-1+b1) but 1.68.4-1 is installed
 libpython3.10-stdlib : Breaks: python3-gdbm (< 3.9.9-1~) but 3.9.7-1 is installed
 obs-studio : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-apt : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-brlapi : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-cairo : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-cffi-backend : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-cups : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-dbus : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-dev : Depends: python3 (= 3.10.4-0ubuntu2) but 3.9.4-1build1 is installed
 python3-distutils : Depends: python3:any (>= 3.10.1-0~)
                     Depends: python3-lib2to3 (= 3.10.4-0ubuntu1) but 3.9.7-1 is installed
 python3-evdev : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-gi : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
 python3-gi-cairo : Depends: python3 (>= 3.10~) but 3.9.4-1build1 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

몇가지 정보:

운영 체제 정보

NAME="Pop!_OS"
VERSION="21.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 21.10"
VERSION_ID="21.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=impish
UBUNTU_CODENAME=impish
LOGO=distributor-logo-pop-os

python3 버전: 3.9.7

/etc/apt/sources.list.d/ 목록:

alexlarsson-ubuntu-flatpak-impish.list
alexlarsson-ubuntu-flatpak-impish.list.save
archive_uri-http_debian_drdteam_org_-impish.list
archive_uri-http_debian_drdteam_org_-impish.list.save
archive_uri-https_dl_winehq_org_wine-builds_ubuntu_-impish.list
archive_uri-https_dl_winehq_org_wine-builds_ubuntu_-impish.list.save
archive_uri-https_packages_microsoft_com_ubuntu_20_04_prod-impish.list
archive_uri-https_packages_microsoft_com_ubuntu_20_04_prod-impish.list.save
edd-ubuntu-misc-impish.list
edd-ubuntu-misc-impish.list.save
flexiondotorg-ubuntu-mangohud-impish.list
flexiondotorg-ubuntu-mangohud-impish.list.save
google-chrome.list
google-chrome.list.save
home-ungoogled_chromium.list
home-ungoogled_chromium.list.save
mono-official-stable.list
mono-official-stable.list.save
nathan-renniewaldock-ubuntu-flux-impish.list
nathan-renniewaldock-ubuntu-flux-impish.list.save
nicotine-team-ubuntu-stable-impish.list
nicotine-team-ubuntu-stable-impish.list.save
pop-os-apps.sources
pop-os-apps.sources.save
pop-os-release.sources
pop-os-release.sources.save
regolith-linux-ubuntu-release-impish.list
regolith-linux-ubuntu-release-impish.list.save
system.sources
system.sources.save
ubuntu-wine-ubuntu-ppa-impish.list
ubuntu-wine-ubuntu-ppa-impish.list.save
vscode.list
vscode.list.save
wine-ubuntu-wine-builds-impish.list
wine-ubuntu-wine-builds-impish.list.save

/etc/apt/sources.list.d/system.sources 목록:

X-Repolib-Name: Pop_OS System Sources
Enabled: yes
Types: deb deb-src
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: impish impish-security impish-updates impish-backports
Components: main restricted universe multiverse
X-Repolib-Default-Mirror: http://us.archive.ubuntu.com/ubuntu/

관련 정보