在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. 【Learning Python】【第四章】Python代码结构(一)

    这一章的主旨在于介绍python的代码结构 缩进 在很多的编程语言中,一般{}用于控制代码块,比如以下的一段C代码 if(var <= 10) { printf("....." ...

  2. HDU 5384 AC自动机

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5384 题意:给n个母串,给m个匹配串,求每个母串依次和匹配串匹配,能得到的数目和. 分析:之前并不知道AC ...

  3. Caffe 源碼閱讀(四) Layer.hpp Layer.cpp

    1.Setup() Layer初始化参数 (1.完成层参数的读入.处理 2.设置底层顶层的shape,在前向传播前完成) InitMutex CheckBolbCounts: LayerSetup:d ...

  4. 开源免费天气预报接口API以及全国所有地区代码!!(国家气象局提供) 【转】

    国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...

  5. 如何使用Python3.4连接MySQL

    http://www.tuicool.com/articles/yqayEv import pymysql conn = pymysql.connect(host='localhost', port= ...

  6. 富文本编辑器kindeditor配置

    <!--富文本编辑器kindeditor配置↓ --> <link type="text/css" rel="stylesheet" href ...

  7. Logback日志系统配置攻略

    logback是log4j作者推出的新日志系统,原生支持slf4j通用日志api,允许平滑切换日志系统,并且对简化应用部署中日志处理的工作做了有益的封装. 官方地址为:http://logback.q ...

  8. Android倒计时:计算两个时间将得到的时间差转化为倒计时(xx时xx分xx秒格式)

    首先是一个自定义控件: public class RushBuyCountDownTimerView extends LinearLayout { // 小时,十位 private TextView ...

  9. MyBatis笔记

    Mybatis:将java对象映射成SQL语句,再将结果转化为java对象,解决了java对象和sql拼接.结果集的问题,又可以自己写sql语句 总体结构: 根据JDBC规范建立与数据库的连接 通过反 ...

  10. js实现图片实时预览

    注: 此博客转自 http://www.cnblogs.com/goody9807/p/6064582.html  转载请注明出处 <body> 上传图片: <input type= ...