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

时间:2017-07-27 11:22:53

标签: ruby-on-rails linux ubuntu dpkg

我正在尝试在ubuntu 17.04上安装rails但是它出错了。然后我尝试运行其他安装,但错误是相同的。
E:dpkg被中断,您必须手动运行'sudo dpkg --configure -a'才能解决问题。
当我尝试执行 sudo dpkg --configure -a 时, 我面对以下输出:

Setting up python-crypto (2.6.1-7) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in  from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in  from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error processing package python-crypto (--configure):
     subprocess installed post-installation script returned error exit status 1

Setting up python-sqlparse (0.2.2-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in  from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in  from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package python-sqlparse (--configure): subprocess installed post-installation script returned error exit status 1
Setting up python-wheel (0.29.0-2) ...
Traceback (most recent call last):
    File "/usr/bin/pycompile", line 35, in  from debpython.version import SUPPORTED, debsorted, vrepr, \
    File "/usr/share/python/debpython/version.py", line 24, in  from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-wheel (--configure):
        subprocess installed post-installation script returned error exit status 1

Setting up python-tz (2014.10~dfsg1-0ubuntu2) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in  from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in  from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-tz (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of python-keyrings.alt:
     python-keyrings.alt depends on python-crypto; however:
      Package python-crypto is not configured yet.

    dpkg: error processing package python-keyrings.alt (--configure):
     dependency problems - leaving unconfigured
    Setting up python-gi (3.22.0-2) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-gi (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-mysqldb (1.3.7-1.1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-mysqldb (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: error processing package apport (--configure):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting configuration
    Setting up python-django (1.8.7-1ubuntu11) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-django (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-dbus (1.2.4-1) ...
    Remove stale byte-compiled files...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-dbus (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-pip (9.0.1-2) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-pip (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-xdg (0.25-4) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in 
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-xdg (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of python-secretstorage:
     python-secretstorage depends on python-dbus; however:
      Package python-dbus is not configured yet.

    dpkg: error processing package python-secretstorage (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of python-keyring:
     python-keyring depends on python-dbus; however:
      Package python-dbus is not configured yet.
     python-keyring depends on python-secretstorage; however:
      Package python-secretstorage is not configured yet.

    dpkg: error processing package python-keyring (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     python-crypto
     python-sqlparse
     python-wheel
     python-tz
     python-keyrings.alt
     python-gi
     python-mysqldb
     apport
     python-django
     python-dbus
     python-pip
     python-xdg
     python-secretstorage
     python-keyring

Tried following solution,


    [cd /var/lib/dpkg/updates
    sudo rm *
    sudo apt-get update][1]
来自here

但没有帮助我。 我使用python3.5作为我的默认python。我用别名改了它。

3 个答案:

答案 0 :(得分:1)

确保在@extends('layouts.app') @section('content') @foreach($title as $titles) <h1>{{$titles}}</h1> @endforeach @endsection

下删除所有内容

然后再次尝试命令:

/var/lib/dpkg/updates

答案 1 :(得分:0)

尝试更改python版本,对我来说它起作用了,您可以使用update-alternatives --config在python版本之间切换,而无需使用别名。

答案 2 :(得分:-1)

之前我遇到过这个问题,因为安装过程中出了问题。尝试使用此命令修复损坏的包:

sudo apt-get install -f

然后尝试再次运行sudo dpkg --configure -a

参考:https://askubuntu.com/a/163339/183864