我不能再用apt-get安装或升级软件包了,因为包python-problem-report、python-apport和apport似乎造成了一些问题。我尝试过的任何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 <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
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 <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
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 <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-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个包选择了“锁定当前版本”,但同样的错误仍然发生。
任何帮助都将不胜感激。
发布于 2013-01-13 17:04:22
我发现了问题。我手动安装了一个更新版本的python (版本3.2,但通过包安装的版本是2.7),我只是将/usr/bin/python重定向到python3.2。显然,在3.2中,/usr/bin/pyclean中使用的一些语法不再有效。将/usr/bin/python的原始链接恢复到/usr/bin/python2解决了这个问题。现在,脚本可以在没有任何问题的情况下运行。
我希望这能帮到某人。
发布于 2015-10-06 09:13:35
我也有同样的问题。一个更清洁的解决方案是使用:
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,然后重置到3之后,清除了apt。
https://askubuntu.com/questions/240256
复制相似问题