sudo apt-get update 실행 중 오류 발생: "ModuleNotFoundError: 'apt_pkg'라는 모듈이 없습니다."

sudo apt-get update 실행 중 오류 발생: "ModuleNotFoundError: 'apt_pkg'라는 모듈이 없습니다."

저는 우분투를 처음 접했습니다. 나는 sudo apt-get update오류가 발생하기 위해 실행하려고했습니다 . 이전에는 이런 일이 일어나지 않았습니다.

$ sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease             
Hit:2 http://dl.google.com/linux/chrome/deb stable Release               
Hit:3 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu bionic InRelease
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease             
Hit:6 http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic InRelease     
Hit:7 http://in.archive.ubuntu.com/ubuntu bionic InRelease                    
Hit:8 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease            
Hit:9 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease          
Get:10 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]  
Fetched 88.7 kB in 9s (9,888 B/s)                    
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'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
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'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

이 문제의 원인은 무엇이며 어떻게 해결할 수 있습니까?

답변1

그래서 오류를 해결했습니다. Python을 제거하고 다시 설치했는데 붐!

관련 정보