使用apt-get安装任何内容时出错

每次我从存储库安装一些东西时,在安装结束时我会收到如下错误消息(例如:gparted) –

harish@harish-desktop:~$ sudo apt-get install --reinstall gparted Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libbonoboui2-0 libbonoboui2-common libcf0 libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common libmysqlclient18 libnetcdf-dev libnetcdfc++4 libnetcdff5 libpq5 libswscale2 libvtk5.8 linux-headers-3.19.0-25 linux-headers-3.19.0-25-generic linux-image-3.19.0-25-generic linux-image-extra-3.19.0-25-generic mysql-common python-chardet-whl python-colorama python-colorama-whl python-distlib python-distlib-whl python-gnome2 python-html5lib python-html5lib-whl python-keybinder python-pip python-pip-whl python-pyorbit python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl python-vtk python-wheel python-wxmpl tcl-vtk Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. 8 not fully installed or removed. Need to get 0 B/524 kB of archives. After this operation, 0 B of additional disk space will be used. (Reading database ... 303324 files and directories currently installed.) Preparing to unpack .../gparted_0.18.0-1_amd64.deb ... Unpacking gparted (0.18.0-1) over (0.18.0-1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1.1) ... Setting up apport (2.14.1-0ubuntu3.15) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package apport (--configure): subprocess installed post-installation script returned error exit status 3 dpkg: dependency problems prevent configuration of apport-gtk: apport-gtk depends on apport (>= 0.41); however: Package apport is not configured yet. dpkg: error processing package apport-gtk (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Setting up apt-offline (1.3.1ubuntu0.1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package apt-offline (--configure): subprocess installed post-installation script returned error exit status 3 Setting up blueman (1.23-git201403102151-1ubuntu1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package blueman (--configure): subprocess installed post-installation script returned error exit status 3 No apport report written because MaxReports is reached already Setting up gimp (2.8.10-0ubuntu1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package gimp (--configure): subprocess installed post-installation script returned error exit status 3 No apport report written because MaxReports is reached already Setting up python-psutil (1.2.1-1ubuntu2) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package python-psutil (--configure): subprocess installed post-installation script returned error exit status 3 No apport report written because MaxReports is reached already dpkg: dependency problems prevent configuration of light-locker-settings: light-locker-settings depends on python-psutil; however: Package python-psutil is not configured yet. dpkg: error processing package light-locker-settings (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already Setting up python-tz (2012c-1ubuntu0.1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package python-tz (--configure): subprocess installed post-installation script returned error exit status 3 No apport report written because MaxReports is reached already Setting up gparted (0.18.0-1) ... Errors were encountered while processing: apport apport-gtk apt-offline blueman gimp python-psutil light-locker-settings python-tz E: Sub-process /usr/bin/dpkg returned an error code (1) 

编辑1:

 No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty 

编辑2:

 harish@harish-desktop:~/test$ apt-cache policy apport apport: Installed: 2.14.1-0ubuntu3.15 Candidate: 2.14.1-0ubuntu3.15 Version table: *** 2.14.1-0ubuntu3.15 0 500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 100 /var/lib/dpkg/status 2.14.1-0ubuntu3 0 500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages 

编辑3:

 harish@harish-desktop:~/test$ sudo dpkg --configure -a [sudo] password for harish: Setting up gimp (2.8.10-0ubuntu1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package gimp (--configure): subprocess installed post-installation script returned error exit status 3 Setting up python-tz (2012c-1ubuntu0.1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package python-tz (--configure): subprocess installed post-installation script returned error exit status 3 Setting up blueman (1.23-git201403102151-1ubuntu1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package blueman (--configure): subprocess installed post-installation script returned error exit status 3 Setting up python-psutil (1.2.1-1ubuntu2) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package python-psutil (--configure): subprocess installed post-installation script returned error exit status 3 Setting up apport (2.14.1-0ubuntu3.15) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package apport (--configure): subprocess installed post-installation script returned error exit status 3 Setting up apt-offline (1.3.1ubuntu0.1) ... E: pycompile:233: Requested versions are not installed dpkg: error processing package apt-offline (--configure): subprocess installed post-installation script returned error exit status 3 dpkg: dependency problems prevent configuration of apport-gtk: apport-gtk depends on apport (>= 0.41); however: Package apport is not configured yet. dpkg: error processing package apport-gtk (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of light-locker-settings: light-locker-settings depends on python-psutil; however: Package python-psutil is not configured yet. dpkg: error processing package light-locker-settings (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: gimp python-tz blueman python-psutil apport apt-offline apport-gtk light-locker-settings 

编辑4:

 harish@harish-desktop:~/test$ /usr/bin/python --version Python 2.7.6 

编辑5:

 harish@harish-desktop:~/test$ head -n233 /usr/bin/pycompile | tail -1 log.error('Requested versions are not installed') 

编辑6:

 harish@harish-desktop:~/test$ apt-cache policy python-minimal python-minimal: Installed: 2.7.5-5ubuntu3 Candidate: 2.7.5-5ubuntu3 Version table: *** 2.7.5-5ubuntu3 0 500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages 100 /var/lib/dpkg/status 

您已经安装了不兼容的python版本,这会破坏apt命令。

因此,下载一些Python包并通过以下命令安装

 mkdir ~/repair_python cd ~/repair_python apt-get download python2.7-minimal libpython2.7-minimal python-minimal python2.7 sudo dpkg -i --force-all *.deb 

删除一些包,因为sudo apt-get install -fsudo dpkg --congigure -a没有效果

 sudo apt-get remove gimp apport apport-gtk apt-offline blueman python-psutil light-locker-settings python-tz 

现在使用主服务器重新安装它们

 sudo sed -i 's/in.archive/archive/' /etc/apt/sources.list sudo apt-get update sudo apt-get install -f sudo apt-get install gimp blueman light-locker-settings apport apport-gtk apt-offline sudo apt-get install --reinstall gparted sudo apt-get autoremove