在尝试安装pdfshuffler (来自Debian )之后,出现了一个与依赖问题相关的错误。好像需要python 2软件包,所以我试着安装它,但是我得到了同样的错误消息。在查找了类似的问题之后,我尝试使用apt-get清理、安装-f、自动删除等等,但是这是无用的,处理过程中遇到的错误列表也在不断增加。我留下了在apt-get升级之后得到的错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
mendeleydesktop
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
15 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 python-crypto (2.6.1-7) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-crypto (--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 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-wheel (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-roman (2.0.0-2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-roman (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-pypdf2 (1.26.0-2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-pypdf2 (--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 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-gi (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-epydoc (3.0.1+dfsg-14) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-epydoc (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of pdfshuffler:
pdfshuffler depends on python-pypdf2 | python-pypdf (>= 1.10); however:
Package python-pypdf2 is not configured yet.
Package python-pypdf is not installed.
dpkg: error processing package pdfshuffler (--configure):
dependency problems - leaving unconfigured
Setting up python-dbus (1.2.4-1+b1) ...
Remove stale byte-compiled files...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
dpkg: error processing package python-dbus (--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 27, in
import optparse
File "/usr/lib/python2.7/optparse.py", line 1557
print(self.get_usage(), file=file)
^
SyntaxError: invalid syntax
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-docutils:
python-docutils depends on python-roman; however:
Package python-roman is not configured yet.
dpkg: error processing package python-docutils (--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
dpkg: dependency problems prevent configuration of python-gobject:
python-gobject depends on python-gi (>= 3.22.0-2); however:
Package python-gi is not configured yet.
dpkg: error processing package python-gobject (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-poppler:
python-poppler depends on python-gobject (>= 2.10.1); however:
Package python-gobject is not configured yet.
dpkg: error processing package python-poppler (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-crypto
python-wheel
python-roman
python-pypdf2
python-keyrings.alt
python-gi
python-epydoc
pdfshuffler
python-dbus
python-xdg
python-secretstorage
python-docutils
python-keyring
python-gobject
python-poppler
E: Sub-process /usr/bin/dpkg returned an error code (1)当我在任何PACKAGE中尝试sudo apt-get install时,都会得到类似的结果。我还尝试编辑/var/lib/dpkg/status文件,删除未正确安装或配置的python包的条目,但没有起到帮助作用(在试图重新安装或删除这些包时,同样的问题再次出现)。
有什么想法吗?
谢谢!
(系统: Debian拉伸w/KDE等离子体。I7 8500 U 16 I7)
在菲利佩·布兰德汉堡的S评论之后,我在optparse.py中查找错误:
eric@debian:~$ dpkg -S /usr/lib/python2.7/optparse.py
libpython2.7-minimal:amd64: /usr/lib/python2.7/optparse.py
eric@debian:~$ dpkg -V libpython2.7-minimal
??5?????? /usr/lib/python2.7/optparse.py
eric@debian:~$ ls -l /usr/lib/python2.7/optparse.py
-rw-r--r-- 1 eric eric 60337 Mar 20 00:01 /usr/lib/python2.7/optparse.py
eric@debian:~$ readlink -f /usr/lib/python2.7/optparse.py
/usr/lib/python2.7/optparse.py这是否意味着md5sum验证失败了?
发布于 2018-04-15 23:54:44
所以它看起来像是Python2.7安装中的文件optparse.py被破坏了。更具体地说,它似乎已被覆盖,并被Python3中的optparse.py副本所取代。
dpkg -V的输出显示了许多字段,检查所有者、组、模式等。输出中的5表示系统中文件的MD5校验和与包清单中的不匹配。(换句话说,在安装包后,内容已经被修改。)
不太确定你怎么知道是什么原因造成的.如果您已经安装了Python模块,作为root,使用的不是O.S.包分发版,这可以解释它.也许如果您使用pip安装了什么?虽然pip通常擅长将Python2和Python3模块分开.而且,我不明白为什么它会特别接触optparse.py .
无论如何,要解决这个问题,您可以要求apt-get重新安装软件包,这将修复损坏:
$ sudo apt-get install --reinstall libpython2.7-minimalhttps://unix.stackexchange.com/questions/437788
复制相似问题