E: dpkg 被中断,您必须手动运行 'sudo dpkg --configure -a' 来纠正

0 linux ubuntu ruby-on-rails dpkg

我正在尝试在 ubuntu 17.04 上安装 Rails,但出现错误。然后我尝试运行其他安装,但错误是相同的。
E: dpkg 被中断,您必须手动运行“sudo dpkg --configure -a”来纠正问题。
当我尝试执行sudo dpkg --configure -a时,我面临以下输出:

设置 python-crypto (2.6.1-7) ...
回溯(最近一次调用最后一次):
文件“/usr/bin/pycompile”,第 35 行,来自 debpython.version import SUPPORTED、debsorted、vrepr、\
文件“/usr/share/python/debpython/version.py”,第 24 行,来自 ConfigParser import SafeConfigParser ImportError:没有名为“ConfigParser”的模块 dpkg:处理包 python-crypto (--configure) 时出错:
     子进程安装的安装后脚本返回错误退出状态 1

设置 python-sqlparse (0.2.2-1) ...
回溯(最近一次调用最后一次):
文件“/usr/bin/pycompile”,第 35 行,来自 debpython.version import SUPPORTED、debsorted、vrepr、\
文件“/usr/share/python/debpython/version.py”,第 24 行,来自 ConfigParser import SafeConfigParser
导入错误:没有名为“ConfigParser”的模块
dpkg:处理包 python-sqlparse 时出错(--configure):子进程安装的安装后脚本返回错误退出状态 1
设置 python-wheel (0.29.0-2) ...
回溯(最近一次调用最后一次):
    文件“/usr/bin/pycompile”,第 35 行,来自 debpython.version import SUPPORTED、debsorted、vrepr、\
    文件“/usr/share/python/debpython/version.py”,第 24 行,来自 ConfigParser import SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-wheel 时出错(--configure):
        子进程安装的安装后脚本返回错误退出状态 1

设置 python-tz (2014.10~dfsg1-0ubuntu2) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,来自 debpython.version import SUPPORTED、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,来自 ConfigParser import SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-tz 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    dpkg:依赖性问题阻止配置 python-keyrings.alt:
     python-keyrings.alt 依赖于 python-crypto;然而:
      软件包 python-crypto 尚未配置。

    dpkg:处理包 python-keyrings.alt 时出错(--configure):
     依赖性问题 - 未配置
    设置 python-gi (3.22.0-2) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-gi 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    设置 python-mysqldb (1.3.7-1.1) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-mysqldb 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    dpkg:处理包 apport 时出错(--configure):
     包处于非常糟糕的不一致状态;你应该
     在尝试配置之前重新安装它
    设置 python-django (1.8.7-1ubuntu11) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-django 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    设置 python-dbus (1.2.4-1) ...
    删除过时的字节编译文件...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-dbus 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    设置 python-pip (9.0.1-2) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-pip 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    设置 python-xdg (0.25-4) ...
    回溯(最近一次调用最后一次):
      文件“/usr/bin/pycompile”,第 35 行,位于
        从 debpython.version 导入支持、debsorted、vrepr、\
      文件“/usr/share/python/debpython/version.py”,第 24 行,位于
        从 ConfigParser 导入 SafeConfigParser
    导入错误:没有名为“ConfigParser”的模块
    dpkg:处理包 python-xdg 时出错(--configure):
     子进程安装的安装后脚本返回错误退出状态 1
    dpkg:依赖性问题阻止配置 python-secretstorage:
     python-secretstorage 依赖于 python-dbus;然而:
      软件包 python-dbus 尚未配置。

    dpkg:处理包 python-secretstorage 时出错(--configure):
     依赖性问题 - 未配置
    dpkg:依赖性问题阻止了 python-keyring 的配置:
     python-keyring 依赖于 python-dbus;然而:
      软件包 python-dbus 尚未配置。
     python-keyring 依赖于 python-secretstorage;然而:
      软件包 python-secretstorage 尚未配置。

    dpkg:处理包 python-keyring 时出错(--configure):
     依赖性问题 - 未配置
    处理时遇到错误:
     python 加密
     python-sqlparse
     蟒蛇轮
     蟒蛇-tz
     python-keyrings.alt
     python-gi
     python-mysqldb
     分配
     python-django
     python-dbus
     python-pip
     python-xdg
     python 秘密存储
     python 钥匙圈

尝试了以下解决方案,


    [cd /var/lib/dpkg/updates
    须藤 rm *
    sudo apt-get 更新][1]

这里开始 ,但没有帮助我。我使用 python3.5 作为我的默认 python。我已经使用别名更改了它。

Ric*_*lla 7

确保删除以下所有内容:/var/lib/dpkg/updates

然后再次尝试该命令:

sudo dpkg --configure -a 
Run Code Online (Sandbox Code Playgroud)