在Ubuntu中安装软件的时候经常碰到E: Unable to correct problems, you have held broken packages.的错误,顾名思义是因为某些软件包冲突导致,幸运的话sudo apt-get update && sudo apt-get upgrade 可以解决,但这种情况属于可遇不可求,更多的适合这么做不济于事。这样一来如何彻底解决就成了一个问题,经过多次摸索之后,将可行的解决方法记录如下:

以安装libxml2-dev时错误为例,安装时提示如下错误:

$ sudo apt-get install libxml2-dev
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:
 libxml2-dev : Depends: libxml2 (= 2.7.8.dfsg-5.1ubuntu4) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed

解决方法如下:

$sudo apt-get install aptitude
$aptitude why-not libxml2
p   shared-mime-info:i386 Provides shared-mime-info                  
p   shared-mime-info:i386 Depends  libxml2:i386 (>= 2.7.4)           
p   libxml2:i386          Breaks   libxml2 (!= 2.7.8.dfsg-5.1ubuntu4)

$dpkg -l | grep libxml2
找到已经安装的对应的libxml2包
$sudo dpkg --purge --force-all libxml2
# 删除libxml2,并删除其他所有依赖包,--force-all参数很重要
$sudo apt-get -f install
# 强制安装欠缺的包
$sudo apt-get install libxml2-dev

E: Unable to correct problems, you have held broken packages 解决方法的更多相关文章

  1. E: Unable to correct problems, you have held broken packages

    问题: apt install libmysqlclient-dev Reading package lists... DoneBuilding dependency tree       Readi ...

  2. ubuntu 'Unable to correct problems, you have held broken packages' 错误

    在用apt 安装软件时,有时会用国内的源以加快下载速度. 但是在使用ubuntu 14.04的过程中,这一过程可能会导致错误“Unable to correct problems, you have ...

  3. ubuntu16 安装openssh-server 一直安装不上Unable to correct problems, you have held broken packages

    zengqi@zengqi:~$ sudo apt-get install openssh-server Reading package lists... DoneBuilding dependenc ...

  4. 解决 E: Unable to correct problems, you have held broken packages. 问题

    参考: Unable to correct problems, you have held broken packages 环境 Ubuntu 14.04, 64bit 问题 在安装gcc-4.9的时 ...

  5. Unable to correct problems, you have held broken packages

    Use aptitude instead of apt-get. It is more intelligent. It not only will handle downgrading conflic ...

  6. 如何解决Ubuntu下的“E: Unable to correct problems, you have held broken packages.”的问题. aptitude

    今天安装build-essential时出现了以下问题,这属于包的依赖. 解决方案: 1,sudo apt-get install aptitude:完成aptitude命令安装 2,sudo apt ...

  7. E: Unable to correct problems, you have held broken packages-之apt-get 下载报依赖问题

    今天在新来了一台ubutnu 18.04 在安装zabbix客户端是报依赖问题 root@VM_0_10:~# apt-get install zabbix-agent Reading package ...

  8. Unable to correct problems, you have held broken package

    其实这篇接着上文(一),主要是解决samba安装的问题,中间又是一路曲折.不过这个问题也算是比较典型,有必要记录一下. #apt-get install smb* 安装失败.其实顺利的话,直接一条这样 ...

  9. ERROR: JDWP Unable to get JNI 1.2 environment的错误解决方法

    在用java编程的时候,在debug模式下偶尔会出现下面的错误,jdk1.6.0-rc1: ERROR: JDWP Unable to get JNI 1.2 environment, jvm-> ...

随机推荐

  1. dreamweaver快捷键

    ---恢复内容开始--- 件菜单 新建文档 Ctrl+N 打开一个 HTML文件 Ctrl+O或者将文件从[文件管理器]或[站点]窗口拖动到[文档]窗口中 在框架中打开 Ctrl+Shift+O 关闭 ...

  2. Mac OS 后台服务注册

    /Library/LaunchAgents/ /Library/LaunchDaemons

  3. 3G数据请求

    //  该类负责发送2G/3G Http请求的数据 #import <Foundation/Foundation.h> #import "ASIHTTPRequest.h&quo ...

  4. Ubuntu 14.04 安装VMware 12

    /*********************************************************************** * Ubuntu 14.04 安装VMware 12 ...

  5. 0-Spark高级数据分析-读书笔记

    学完了<Spark快速大数据分析>,对Spark有了一些了解,计划更近一步,开始学习<Spark高级数据分析>.这本书是用Scala写的,在学习的过程中想把其中的代码转换成Ja ...

  6. Advanced SystemCare 系统优化软件

    这是一款国外非常流行的系统优化软件,功能很全面,而且中文版用起来也没有语言障碍. Pro版: C0184-8F31F-4B337-296F7 8DE4A-352D9-B4531-D60F7 5B91B ...

  7. 如何用Selenium 向CodeMirror 编辑器输入

    用Selenium 自动填写Jenkins上面一个文本输入框,通过css定位很容易,但是输入文字的时候会报错 ElementNotVisibleException: Message: Element ...

  8. UIView详解

    MVC架构模式   MVC(Model-View-Controller)是实现数据和显示数据的视图分离的架构模式(有一定规模的应用都应该实现数据和显示的分离).其中,M代表模型,就是程序中使用的数据和 ...

  9. Chapter 5: Design and implement security

    Configure authentication Authenticating users IIS authentication Anonymous ASP.net impersonation Bas ...

  10. 1.15 kickstart rpm yum

    ###########bootstrap 启动加载器 (pxelinux.0)传输pxelinux.cfg NIC #network interface PXEpxelinux.0/tftp/pxel ...