ImportError:没有名为 debian.deb822 的模块

ImportError:没有名为 debian.deb822 的模块

我的 Ubuntu 14.04 设置似乎完全搞砸了,以至于我无法再使用 apt-get install 成功安装任何软件包。常见错误是“没有名为 debian.deb822 的模块”。下面是一个例子。请注意,我的目标不一定是安装这个特定的包;只是为了能够安装任何软件包。任何帮助都将不胜感激!

box:~/python> sudo apt-get install update-notifier
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apturl is already the newest version.
apturl-common is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 394 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up update-notifier-common (0.154.1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 26, in <module>
    import debian.deb822
ImportError: No module named debian.deb822
dpkg: error processing package update-notifier-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 0.154.1ubuntu1); 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 update-manager:
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

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

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on ubuntu-releasNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                  No apport report written because the error message indicates its a followup error from a previous failure.
            No apport report written because MaxReports is reached already
                                                                          No apport report written because MaxReports is reached already
                                                        e-upgrader-gtk; however:
  Package ubuntu-release-upgrader-gtk is not configured yet.
 ubuntu-desktop depends on update-manager; however:
  Package update-manager is not configured yet.
 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
Errors were encountered while processing:
 update-notifier-common
 update-notifier
 update-manager
 ubuntu-release-upgrader-gtk
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑 1:运行“sudo apt-get update”和“sudo apt-get upgrade”后,输出略有不同,但抛出相同的错误:

box:~> sudo apt-get upgrade update-notifier
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
update-notifier is already the newest version.
The following packages have been kept back:
  libreoffice libreoffice-base libreoffice-base-core libreoffice-base-drivers
  libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw
  libreoffice-gnome libreoffice-gtk libreoffice-gtk3 libreoffice-help-en-us
  libreoffice-impress libreoffice-math libreoffice-style-galaxy
  libreoffice-style-human libreoffice-style-tango libreoffice-writer
  linux-generic linux-generic-lts-vivid linux-headers-generic
  linux-headers-generic-lts-vivid linux-image-generic
  linux-image-generic-lts-vivid linux-signed-generic-lts-vivid
  linux-signed-image-generic-lts-vivid linux-tools-virtual-lts-wily
  openjdk-8-jdk openjdk-8-jre openjdk-8-jre-headless python3-uno shim-signed
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up update-notifier-common (0.154.1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 26, in <module>
    import debian.deb822
ImportError: No module named debian.deb822
dpkg: error processing package update-notifier-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 0.154.1ubuntu1); 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 update-manager:
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

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

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on ubuntu-releasNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                  No apport report written because the error message indicates its a followup error from a previous failure.
            No apport report written because MaxReports is reached already
                                                                          No apport report written because MaxReports is reached already
                                                        e-upgrader-gtk; however:
  Package ubuntu-release-upgrader-gtk is not configured yet.
 ubuntu-desktop depends on update-manager; however:
  Package update-manager is not configured yet.
 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
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑 2:运行@Raphael 建议的修复后,输出有所改变,但问题仍然存在:

box:~/Downloads> sudo apt-get install update-notifier
Reading package lists... Done
Building dependency tree       
Reading state information... Done
update-notifier is already the newest version.
The following packages were automatically installed and are no longer required:
  libreoffice-gtk3 linux-headers-3.13.0-77 linux-headers-3.13.0-77-generic
  linux-image-3.13.0-77-generic linux-image-extra-3.13.0-77-generic
  linux-lts-wily-tools-4.2.0-27 linux-tools-4.2.0-27-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up update-notifier-common (0.154.1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 26, in <module>
    import debian.deb822
ImportError: No module named debian.deb822
dpkg: error processing package update-notifier-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 0.154.1ubuntu1); 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 update-manager:
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

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

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on ubuntu-releasNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                  No apport report written because the error message indicates its a followup error from a previous failure.
            No apport report written because MaxReports is reached already
                                                                          No apport report written because MaxReports is reached already
                                                        e-upgrader-gtk; however:
  Package ubuntu-release-upgrader-gtk is not configured yet.
 ubuntu-desktop depends on update-manager; however:
  Package update-manager is not configured yet.
 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
Errors were encountered while processing:
 update-notifier-common
 update-notifier
 update-manager
 ubuntu-release-upgrader-gtk
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

Ubuntu论坛

这是由于包裹不可用python-six

要安装它,请执行以下操作:

sudo apt-get update; sudo apt-get install --reinstall python-six

编辑1:-

由于apt-get install似乎不起作用,您可以使用以下方法手动安装它:

cd ~/Downloads; wget -c http://ftp.us.debian.org/debian/pool/main/s/six/python-six_1.10.0-3_all.deb; sudo dpkg -i python-six_1.10.0-3_all.deb

编辑2:-

Debian

单个或多个 RFC822 样式段落的控制文件,例如 debian/control、.changes、.dsc、Packages、Sources、Release 等(debian.deb822 模块)

因此,您可能需要该包。要安装:

cd ~/Downloads; wget -c http://ftp.us.debian.org/debian/pool/main/p/python-debian/python-debian_0.1.28_all.deb; sudo dpkg -i python-six_1.10.0-3_all.deb

答案2

问题原来是 Python 的“deb822”和“apt”相关软件包已安装,但位置不对。我 (1) 使用 确定了这些软件包的位置locate deb822,(2) 使用以下方法确定了它们“应该”存放的位置:

python
import numpy
print numpy

然后(3)通过以下方式将文件复制到适当的目录中:

sudo cp -r /usr/lib/python2.7/dist-packages/apt* /appropriate_directory/python2.7/site-packages/
sudo cp -r /usr/lib/python2.7/dist-packages/deb* /appropriate_directory/python2.7/site-packages/

此后,sudo apt-get install X似乎工作正常。

答案3

您有 394 个包尚未更新。这很可能是导致依赖性问题的原因。运行

sudo apt-get update
sudo apt-get upgrade

相关内容