python:冲突导致无法纠正问题,您在 16.04 中持有损坏的软件包错误

python:冲突导致无法纠正问题,您在 16.04 中持有损坏的软件包错误

我知道当 Ubuntu 安装时 python 已经存在了。

而其他使用我机器的用户尝试安装一些第三方工具(例如:mockSSH 等)时,却安装了另一个版本的 Python。现在一些重要的软件(如 meld)不见了。

当我尝试安装它们时,它会向我大喊Unable to correct problems, you have held broken packages.

错误 :

me@my-pc:~$ sudo apt-get install meld
[sudo] password for me: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 meld : Depends: python:any (< 2.8)
        Depends: python:any (>= 2.7.5-5~)
        Depends: python-gi (>= 3.8) but it is not going to be installed
        Depends: python-gi-cairo but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我尝试了各种方法(例如:修复损坏、使用 aptitude 安装、安装自定义包等)但没有任何效果。

例如: 1.强制安装

me@my-pc:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-headers-4.4.0-96 linux-headers-4.4.0-96-generic linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic linux-image-4.4.0-31-generic
  linux-image-4.4.0-96-generic linux-image-4.4.0-97-generic linux-image-extra-4.4.0-31-generic linux-image-extra-4.4.0-96-generic linux-image-extra-4.4.0-97-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
  1. 使用 aptitude 安装
me@my-pc:~$ sudo aptitude -f install meld
The following NEW packages will be installed:
  meld python:i386{ab} python-cairo{a} python-gi{a} python-gi-cairo{a} python-minimal:i386{a} python2.7:i386{a}

python2.7-minimal:i386{a} 升级了 0 个软件包,新安装了 8 个,要删除 0 个,未升级 1 个。需要获取 2,447 kB 的档案。解压后将使用 8,988 kB。以下软件包有未满足的依赖关系:python:冲突:python:i386 但要安装 2.7.11-1。python:i386:冲突:python 但已安装 2.7.13-1。以下操作将解决这些依赖关系:

     Keep the following packages at their current version:
1)     meld [Not Installed]                               
2)     python:i386 [Not Installed]                        
3)     python-cairo [Not Installed]                       
4)     python-gi [Not Installed]                          
5)     python-gi-cairo [Not Installed]                    

     Leave the following dependencies unresolved:         
6)     python-minimal:i386 recommends python:i386         


Accept this solution? [Y/n/q/?]  
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

当我检查 python 时,它列出了这些。

me@my-pc:~$ python
python             python2.7          python2-config     python3.5          python3.5m         python3-config     python3m-config    
python2            python2.7-config   python3            python3.5-config   python3.5m-config  python3m           python-config  

我的问题是,如何修复这些损坏的包并按应有的方式安装 python?

答案1

我找到了解决方案

由于它说有冲突,我尝试通过以下方式安装 python_2.7.11-1德布

sudo dpkg -i python_2.7.11-1_amd64.deb

我遇到了下面的问题。

dpkg: regarding python_2.7.11-1_amd64.deb containing python, pre-dependency problem:
 python pre-depends on python-minimal (= 2.7.11-1)
  python-minimal is not installed.

因此,我尝试安装 python-minimal。

sudo apt-get install python-minimal

通过这种方式,所有相关的东西都设置好了。

我试过了sudo aptitude install meld,成功了!感谢大家的支持!

相关内容