执行apt-get update时 报错ModuleNotFoundError: No module named ‘debian‘

最近在安装环境时执行apt-get update或者upgrade时,总是报错:

Setting up update-notifier-common (3.192.1.11) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 24, in
    import debian.deb822
ModuleNotFoundError: No module named 'debian'
dpkg: error processing package update-notifier-common (--configure):
 installed update-notifier-common package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 3.192.1.11); however:
  Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on update-notifier; however:
  Package update-notifier is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
 update-notifier-common
 update-notifier
 ubuntu-desktop

安装进行不下去,之前好好的,怎么会出现这种奇怪的事呢,按理说apt-get update是Ubuntu最核心和常用的工具了,不大可能会没有正确安装的,仔细想想安装环境过程中都做了些什么,这个 import debian.deb822报错应该是python相关的东西,那最有可能是python安装不对或者版本不对了,于是突然想起为了满足实验某模型的要求安装了个很新的python3.9.6,并且把/usr/bin/python3指向了python3.9.6,可能就是这个python版本太高了的原因引起的,于是删掉/usr/bin/python3,重新创建链接指向python3.6.8,再执行apt-get update就正常了!

Setting up update-notifier-common (3.192.1.11) ...
Setting up update-notifier (3.192.1.11) ...
Setting up ubuntu-desktop (1.417.5) ...

  • 没有reinstall,sudo apt remove python3-debian && sudo apt install python3-debian

  • 亲测: 其实可以执行`sudo apt reinstall python3-debian` 以修复.

执行apt-get update时报错ModuleNotFoundError: No module named ‘debian‘的原因_modulenotfounderror: no module named 'debian-CSDN博客 

你可能感兴趣的:(debian,运维)