问题ModuleNotFoundError:更新ubuntu linux时没有名为“ apt_pkg”的模块

时间:2019-12-14 16:43:17

标签: ubuntu-18.04

在更新 ubuntu 的同时

  

ModuleNotFoundError:没有名为“ apt_pkg”的模块           E:执行脚本APT :: Update :: Post-Invoke-Success'if / usr / bin / test -w / var / lib / command-not-found / -a -e   / usr / lib / cnf-update-db;然后/ usr / lib / cnf-update-db> / dev / null; fi'           E:子流程返回了错误代码

最近我删除了venv目录,之后我开始收到此错误

root@horizon:/home/rkg# sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic InRelease               
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease             
Get:4 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] 
Fetched 163 kB in 2s (93.2 kB/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

请帮助我解决问题

0 个答案:

没有答案