zoukankan      html  css  js  c++  java
  • 因安装包依赖问题导致无法安装的解决办法!

    在 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

    懒惰不会让你一下子跌到 但会在不知不觉中减少你的收获; 勤奋也不会让你一夜成功 但会在不知不觉中积累你的成果 越努力,越幸运。
  • 相关阅读:
    全网通5X_AL10 非定制版 固件汇总
    system.new.dat解压工具sdat2img
    linux 平台中 Android5.0的更新包中system.new.dat文件的解包
    【 henuacm2016级暑期训练-动态规划专题 A 】Cards
    【BZOJ 1486】 [HNOI2009]最小圈
    【BZOJ 1433】[ZJOI2009]假期的宿舍
    【BZOJ 1412】[ZJOI2009]狼和羊的故事
    【BZOJ 1305】[CQOI2009]dance跳舞
    【Codeforces Round #483 (Div. 2) C】Finite or not?
    【Codeforces Round #482 (Div. 2) C】Kuro and Walking Route
  • 原文地址:https://www.cnblogs.com/Rainingday/p/15068427.html
Copyright © 2011-2022 走看看