[安装问题]ffmpeg have unmet dependencies (依赖库冲突)

[ffmpeg安装问题]ffmpeg have unmet dependencies (依赖库冲突)

问题: 安装ffmpeg时出现依赖库的冲突问题

$ sudo apt-get install ffmpeg
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:
 ffmpeg : Depends: libavdevice58 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
          Depends: libavfilter7 (= 7:4.2.7-0ubuntu0.1)
          Depends: libavformat58 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决步骤

step 1. 修复

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done

step2. 重装第一步中出现的冲突库,以查找原因

$sudo apt install libavdevice58=7:4.2.7-0ubuntu0.1 libavfilter7=7:4.2.7-0ubuntu0.1 libavformat58=7:4.2.7-0ubuntu0.1
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:
 libavformat58 : Depends: libchromaprint1 (>= 1.3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Here the problem is from libchromaprint1

上面出现的libchromaprint1 库就是原因.

step3. 查找依赖库的备选版本号

$ apt-cache policy libchromaprint1
libchromaprint1:
  Installed: (none)
  Candidate: 1.5.1-1~20.04.sav0
  Version table:
     1.5.1-1~20.04.sav0 500
        500 http://ppa.launchpad.net/savoury1/multimedia/ubuntu focal/main amd64 Packages
     1.4.3-3build1 500
        500 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages

版本1.5.1-1~20.04.sav0对其他库太新,会产生冲突. 这里我们选择旧版本(1.4.3-3build1)

step4. 安装libchromaprint1 1.4.3-3build1

$  sudo apt install libchromaprint1=1.4.3-3build1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libchromaprint1
0 upgraded, 1 newly installed, 0 to remove and 223 not upgraded.
Need to get 37.6 kB of archives.
...

step5. 重装ffmpeg

$ sudo apt install ffmpeg
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...
问题解决!

总结: 默认的sudo apt-get install ffmpeg安装命令会自动安装所有依赖库的最新版本,而最新版本之间一旦有冲突,就傻了.需要人为手工排查问题库, 手动选择版本号以解决冲突问题.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值