python - Ubuntu16.04:The following packages have unmet dependencies?
天蓬老师
天蓬老师 2017-04-18 10:16:23
0
1
1236

最近不知道设置了什么,现在在ubuntu16.04上使用apt安装软件都失败:

$ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: libglib2.0-dev : Depends: libglib2.0-0 (= 2.48.1-1~ubuntu16.04.1) but 2.48.2-0ubuntu1 is installed Depends: libglib2.0-bin (= 2.48.1-1~ubuntu16.04.1) E: Unmet dependencies. Try using -f.

ps:sudo apt install ipython也是报同样的错误

然后我按照提示进行修复:

$ sudo apt-get -f install Extracting templates from packages: 100% Preconfiguring packages ... dpkg: error processing package libglib2.0-dev (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: libglib2.0-dev E: Sub-process /usr/bin/dpkg returned an error code (1)

准备卸载libglib2.0-dev,却无法卸载,而且报错信息和上面一样,提示reinstall,但是apt命令没有reinstall参数

$ sudo apt-get remove libglib2.0-dev ... After this operation, 10.5 MB disk space will be freed. Do you want to continue? [Y/n] y dpkg: error processing package libglib2.0-dev (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: libglib2.0-dev E: Sub-process /usr/bin/dpkg returned an error code (1)

libglib2.0-dev处于bad inconsistent state所以要reinstall,但是却无法卸载那么该怎么进行reinstall,google以及在其他社区找了很久也没找到答案,请问这是什么原因?


补充

$ sudo apt-get check Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: libglib2.0-dev : Depends: libglib2.0-0 (= 2.48.1-1~ubuntu16.04.1) but 2.48.2-0ubuntu1 is installed Depends: libglib2.0-bin (= 2.48.1-1~ubuntu16.04.1) E: Unmet dependencies. Try using -f.

解决方案

之前google的姿势不对,问题的关键是package is in a very bad inconsistent state; you should reinstall it before attempting a removal

参考资料强制卸载sudo dpkg --remove --force-remove-reinstreq libglib2.0-dev,但是又出现了新的问题,由于包不兼容python3,所以还要sudo ln -s /usr/bin/python2.7 /usr/bin/python,这样一来就只能使用python2.7,然后各种软件配置重新改。

比如youcompleteme要改成python3等等。

let g:ycm_server_python_interpreter = '/usr/bin/python3' let g:ycm_python_binary_path = '/usr/bin/python3'
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复 (1)
巴扎黑

libglib2.0-dev 依赖于 libglib2.48.1-1 和 libglib2.0-bin

但是你系统已经安装了libglib2.48.2-0 > 2.48.1-1 版本高了些

把 libglib2.48.2-0 卸载掉,使用sudo apt-get install package=version命令安装指定版本的libglib

    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责声明 Sitemap
    PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!