python-lockfile을 구성할 때 "제외(IOError, OSError), e: SyntaxError: 잘못된 구문"이 나타납니다.

python-lockfile을 구성할 때 "제외(IOError, OSError), e: SyntaxError: 잘못된 구문"이 나타납니다.

Python으로 인해 Ubuntu에 새 패키지를 설치하는 데 문제가 있습니다.

나는 그것을 시도했지만 sudo apt-get install python3 python3-dev 다음과 같은 결과를 얻었습니다.:

dpkg: error processing python-lockfile (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: error processing python-gi (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: error processing python-apt (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
Setting up python-six (1.3.0-1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-six (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: error processing python-chardet (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: dependency problems prevent configuration of python-debian:
 python-debian depends on python-six; however:
  Package python-six is not configured yet.
 python-debian depends on python-chardet; however:
  Package python-chardet is not configured yet.`
dpkg: error processing python-debian (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier-common:
 update-notifier-common depends on python-apt (>= 0.6.12); however:
  Package python-apt is not configured yet.
 update-notifier-common depends on python-debian; however:
  Package python-debian is not configured yet.`
dpkg: error processing update-notifier-common (--configure):
 dependency problems - leaving unconfigured
Setting up python-sip (4.15.2-1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-sip (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-qt4:
 python-qt4 depends on sip-api-10.1; however:
  Package sip-api-10.1 is not installed.
  Package python-sip which provides sip-api-10.1 is not configured yet.`
dpkg: error processing python-qt4 (--configure):
 dependency problems - leaving unconfigured
dpkg: error processing python-dbus (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: dependency problems prevent configuration of python-qt4-dbus:
 python-qt4-dbus depends on python-dbus (>= 0.84.0-2~); however:
  Package python-dbus is not configured yet.`
dpkg: error processing python-qt4-dbus (--configure):
 dependency problems - leaving unconfigured
dpkg: error processing python-dirspec (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: error processing python-httplib2 (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: error processing python-crypto (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: dependency problems prevent configuration of python-oauthlib:
 python-oauthlib depends on python-crypto; however:
  Package python-crypto is not configured yet.`
dpkg: error processing python-oauthlib (--configure):
 dependency problems - leaving unconfigured
Setting up python-openssl (0.13-2ubuntu4) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-openssl (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-pkg-resources (0.6.37-1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing ubuntu-sso-client-qt (--configure):
 dependency problems - leaving unconfigured
Setting up python-problem-report (2.12.5-0ubuntu2.2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-problem-report (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: error processing python-keyring (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
dpkg: error processing python-lazr.uri (--configure):
 dependency problems - leaving unconfigured
Setting up python-simplejson (3.3.0-2ubuntu2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-simplejson (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-oauth (1.0.1-3build1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-oauth (--configure):
 subprocess installed post-installation script returned error exit status 1
(gconftool-2:20627): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Traceback (most recent call last):
  File "/usr/sbin/gconf-schemas", line 121, in <module>
    trim(os.path.join(defaults_dest,"%gconf-tree.xml"), get_valid_languages())
  File "/usr/sbin/gconf-schemas", line 18, in get_valid_languages
    langs.add(l.split('_')[0])
TypeError: Type str doesnt support the buffer API
dpkg: error processing gconf2 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of aisleriot:
Setting up python-xapian (1.2.15-4) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-xapian (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-xdg (0.25-3) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error processing python-xdg (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: error processing python-configglue (--configure):
 dependency problems - leaving unconfigured
dpkg: too many errors, stopping
Errors were encountered while processing:
 python-lockfile
 duplicity
 deja-dup
 python-gi
 python-apt
 python-six
 python-chardet
 python-debian
 update-notifier-common
 python-sip
 python-qt4
 python-dbus
 python-qt4-dbus
 python-dirspec
 python-httplib2
 python-crypto
 python-oauthlib
 python-openssl
 python-pkg-resources
 python-zope.interface
 python-twisted-core
 python-twisted-web
 python-ubuntu-sso-client
 ubuntu-sso-client
 ubuntu-sso-client-qt
 python-problem-report
 python-keyring
 python-lazr.uri
 python-simplejson
 python-wadllib
 python-oauth
 python-lazr.restfulclient
 python-launchpadlib
 python-apport
 python3-distupgrade
 python3-update-manager
 ubuntu-release-upgrader-core
 update-manager-core
 gconf2
 aisleriot
 gnome-terminal-data
 gnome-terminal
 python-xapian
 apt-xapian-index
 apturl-common
 apturl
 compiz-gnome
 compiz
 deja-dup-backend-gvfs
 python-xdg
 python-configglue
Processing was halted because there were too many errors.`

나는 Google을 통해 찾을 수 있는 대부분의 것을 시도했습니다. 저는 파이썬 2.7.5를 사용하고 있습니다. 나는 apt-get clean이 주제 apt-get autoclean에 대한 모든 변형을 해냈습니다.

꼭 설치하고 싶습니다 python-dev. 어떻게 해야 하나요? 이 시점에서는 시스템을 포맷하는 것 외에는 어떤 극단적인 옵션도 고려할 의향이 있습니다.

출력은 다음과 같습니다sudo apt-get install --reinstall python-lockfile

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
280 not fully installed or removed.
Need to get 0 B/5,207 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 209306 files and directories currently installed.)
Preparing to replace python-lockfile 1:0.8-2ubuntu1 (using .../python-lockfile_1%3a0.8-2ubuntu1_all.deb) ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing /var/cache/apt/archives/python-lockfile_1%3a0.8-2ubuntu1_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named ConfigParser
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/python-lockfile_1%3a0.8-2ubuntu1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

출력은 다음과 같습니다apt-cache policy python-lockfile

python-lockfile:
  Installed: 1:0.8-2ubuntu1
  Candidate: 1:0.8-2ubuntu1
  Version table:
 *** 1:0.8-2ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
        100 /var/lib/dpkg/status
python-minimal:
  Installed: 2.7.5-5ubuntu1
  Candidate: 2.7.5-5ubuntu1
  Version table:
 *** 2.7.5-5ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
        100 /var/lib/dpkg/status

편집 - 5

출력 -> sudo dpkg -C --->http://goo.gl/ib3RqB(죄송합니다. 단어수 제한이 초과되어 이 파일에 게시됩니다.)

편집 - 6

여러분의 인내심과 도움에 감사드립니다.

제안 사항을 검토한 후에도 여전히 오류가 발생하며 결과는 다음과 같습니다.

sudo dpkg --configure -a  -> http://goo.gl/uab19E
sudo apt-get install -f   -> http://goo.gl/wUZXgY

출력은 다음과 같습니다sudo apt-get --reinstall ubuntu-release-upgrader-gtk 설치

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
108 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for ubuntu-release-upgrader-gtk:amd64

답변1

나는 매우 비슷한 문제가 있습니다. python3대신에 사용하는 것에서 오는 것 같습니다python2.7

저는 /usr/bin/pythonpython3에 연결했습니다. (좀 더 편의를 위해 python3을 설치한 후 링크를 ​​변경했는데, 앨리어싱이 더 나은 아이디어인 것 같습니다.)

어쨌든 연결을 해제했다가 다시 연결한 후에 python2.7는 업그레이드가 제대로 작동했습니다.

답변2

The following packages are in a mess due to serious problems during
    installation.  They must be reinstalled for them (and any packages
    that depend on them) to function properly:
     python-lxml          pythonic binding for the libxml2 and libxslt libraries
     python-aptdaemon     Python 2 module for the server and client of aptdaemon
     python3-uno          Python-UNO bridge
     python-dbus          simple interprocess messaging system (Python interface)
    python-defer         Small framework for asynchronous programming (Python 2)
     python-gi            Python 2.x bindings for gobject-introspection libraries
     python3-speechd      Python interface to Speech Dispatcher
     python3-xdg          Python 3 library to access freedesktop.org standards
     python-aptdaemon.gtk3widgets Python 2 GTK+ 3 widgets to run an aptdaemon clien
     python3-requests     elegant and simple HTTP library for Python3, built for hu
     python-lazr.uri      library for parsing, manipulating, and generating URIs
     python3-crypto       cryptographic algorithms and protocols for Python 3
     python3-louis        Python bindings for liblouis
     python-cairo         Python bindings for the Cairo vector graphics library
     python-keyring       store and access your passwords safely
     python-gobject-2     deprecated static Python bindings for the GObject library
     python3-chardet      universal encoding detector
     python3-lxml         pythonic binding for the libxml2 and libxslt libraries
     python3-cairo        Python 3 bindings for the Cairo vector graphics library
     python-gtk2          Python bindings for the GTK+ widget set
     python3-dirspec      Python User Folders Specification Library
     python-chardet       universal character encoding detector
     python-cupshelpers   Python modules for printer configuration with CUPS
     dh-python            Debian helper tools for packaging Python libraries and ap
     python-crypto        cryptographic algorithms and protocols for Python
     python-dirspec       Python User Folders Specification Library
     python3-six          Python 2 and 3 compatibility library (Python 3 interface)
     python-lockfile      file locking library for Python
     python-apt           Python interface to libapt-pkg
     python3-oauthlib     generic, spec-compliant implementation of OAuth for Pytho
     python3-xkit         library for the manipulation of xorg.conf files (Python 3
     python-httplib2      comprehensive HTTP client library written for Python
     python-debian        Python modules to work with Debian-related data formats
     python3-urllib3      HTTP library with thread-safe connection pooling for Pyth
     python-lazr.restfulclient client for lazr.restful-based web services
     python-configglue    Glues together optparse.OptionParser and ConfigParser.Con
     python-launchpadlib  Launchpad web services client library

따라서 메시지는 명확합니다. 이러한 패키지를 모두 다시 설치한 다음 다른 모든 항목을 재구성해야 합니다.

sudo apt-get --reinstall install python-lxml python-aptdaemon python3-uno python-dbus python-defer python-gi python3-speechd python3-xdg python-aptdaemon.gtk3widgets python3-requests python-lazr.uri python3-crypto python3-louis python-cairo python-keyring python-gobject-2 python3-chardet python3-lxml python3-cairo python-gtk2 python3-dirspec python-chardet python-cupshelpers dh-python python-crypto python-dirspec python3-six python-lockfile python-apt python3-oauthlib python3-xkit python-httplib2 python-debian python3-urllib3 python-lazr.restfulclient python-configglue python-launchpadlib

그런 다음 모든 패키지를 구성/재구성합니다.

sudo dpkg --configure -a
sudo apt-get install -f

아, 또한 모든 패키지의 최신 버전을 사용할 수 있도록 trusty로 업그레이드하는 것이 좋습니다.

관련 정보