python-problem-report python-apport apport break apt-get

我无法再使用apt-get安装或升级软件包,因为软件包python-problem-reportpython-apportapport似乎会导致一些问题。 我尝试过的任何apt-get命令都会导致以下错误消息:

 Preparing to replace python-problem-report 2.0.1-0ubuntu15.1 (using .../python-problem-report_2.0.1-0ubuntu15.1_all.deb) ... File "/usr/bin/pyclean", line 64 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 64 except (IOError, OSError), e: ^ SyntaxError: invalid syntax dpkg: error processing /var/cache/apt/archives/python-problem-report_2.0.1-0ubuntu15.1_all.deb (--unpack): subprocess new pre-removal script returned error exit status 1 Traceback (most recent call last): File "/usr/bin/pycompile", line 36, 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 while cleaning up: subprocess installed post-installation script returned error exit status 1 Preparing to replace python-apport 2.0.1-0ubuntu15.1 (using .../python-apport_2.0.1-0ubuntu15.1_all.deb) ... File "/usr/bin/pyclean", line 64 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 64 except (IOError, OSError), e: ^ SyntaxError: invalid syntax dpkg: error processing /var/cache/apt/archives/python-apport_2.0.1-0ubuntu15.1_all.deb (--unpack): subprocess new pre-removal script returned error exit status 1 Traceback (most recent call last): File "/usr/bin/pycompile", line 36, 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 while cleaning up: subprocess installed post-installation script returned error exit status 1 Preparing to replace apport 2.0.1-0ubuntu15.1 (using .../apport_2.0.1-0ubuntu15.1_all.deb) ... apport stop/waiting File "/usr/bin/pyclean", line 64 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 64 except (IOError, OSError), e: ^ SyntaxError: invalid syntax dpkg: error processing /var/cache/apt/archives/apport_2.0.1-0ubuntu15.1_all.deb (--unpack): subprocess new pre-removal script returned error exit status 1 apport start/running Traceback (most recent call last): File "/usr/bin/pycompile", line 36, 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 while cleaning up: subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/python-problem-report_2.0.1-0ubuntu15.1_all.deb /var/cache/apt/archives/python-apport_2.0.1-0ubuntu15.1_all.deb /var/cache/apt/archives/apport_2.0.1-0ubuntu15.1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

即使我尝试安装与3个故障排除软件包无关的软件包,也会发生这种情况。 我还在muon为这3个包选择了“Lock at Current Version”,但仍然会出现相同的错误。

任何帮助将不胜感激。

我发现了问题。 我手动安装了较新版本的python (版本3.2,但通过软件包安装的版本是2.7),我只是将/usr/bin/python重定向到python3.2 。 显然在3.2中, /usr/bin/pyclean使用的某些语法不再有效。 将/usr/bin/python的原始链接恢复到/usr/bin/python2解决了这个问题。 现在脚本可以运行而没有任何问题。

我希望这有助于某人……

我有同样的问题。 更清洁的解决方案是使用:

 sudo update-alternatives --config python There are 3 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3 30 auto mode 1 /usr/bin/python2.6 20 manual mode 2 /usr/bin/python2.7 10 manual mode 3 /usr/bin/python3 30 manual mode Press enter to keep the current choice[*], or type selection number: 

然后选择您要使用的那个。 为了解决这个问题,我切换回2.7,然后在用apt清除之后重置为3。