在 ubuntu 20.04(从 18.04 升级)中,我尝试安装 libcairo2-dev,但收到有关缺少依赖项的信息。最后,它看起来像是一切都已安装,但 lib 命名或其他方面存在一些问题。有人有什么想法吗?
> sudo apt install libcairo2-dev
The following packages have unmet dependencies:
libcairo2-dev : Depends: libglib2.0-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
然后
> sudo apt install libglib2.0-dev
The following packages have unmet dependencies:
libglib2.0-dev : Depends: libselinux1-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
然后
> sudo apt install libselinux1-dev
The following packages have unmet dependencies:
libselinux1-dev : Depends: libpcre2-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
然后
> sudo apt install libpcre2-dev
The following packages have unmet dependencies:
libpcre2-dev : Depends: libpcre2-8-0 (= 10.34-7) but 10.34-7+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
但最后还是好了,但还不行
> sudo apt install libpcre2-8-0
libpcre2-8-0 is already the newest version (10.34-7+ubuntu18.04.1+deb.sury.org+1).
编辑:
@N0rbert:正在运行:
> apt-cache policy libpcre2-8-0 libpcre2-dev libselinux1-dev libglib2.0-dev
输出:
libpcre2-8-0:
Installed: 10.34-7+ubuntu18.04.1+deb.sury.org+1
Candidate: 10.34-7+ubuntu18.04.1+deb.sury.org+1
Version table:
*** 10.34-7+ubuntu18.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
10.34-7 500
500 http://mirror.switch.ch/ftp/mirror/ubuntu focal/main amd64 Packages
libpcre2-dev:
Installed: 10.21-1
Candidate: 10.34-7
Version table:
10.34-7 500
500 http://mirror.switch.ch/ftp/mirror/ubuntu focal/main amd64 Packages
*** 10.21-1 100
100 /var/lib/dpkg/status
libselinux1-dev:
Installed: (none)
Candidate: 3.0-1build2
Version table:
3.0-1build2 500
500 http://mirror.switch.ch/ftp/mirror/ubuntu focal/main amd64 Packages
libglib2.0-dev:
Installed: (none)
Candidate: 2.64.2-1~fakesync1
Version table:
2.64.2-1~fakesync1 500
500 http://mirror.switch.ch/ftp/mirror/ubuntu focal/main amd64 Packages
@Parsa Mousavi:从包安装也不起作用:
> sudo dpkg -i libpcre2-dev_10.21-1_amd64.deb
(Reading database ... 271075 files and directories currently installed.)
Preparing to unpack libpcre2-dev_10.21-1_amd64.deb ...
Unpacking libpcre2-dev:amd64 (10.21-1) over (10.21-1) ...
dpkg: dependency problems prevent configuration of libpcre2-dev:amd64:
libpcre2-dev:amd64 depends on libpcre2-8-0 (= 10.21-1); however:
Version of libpcre2-8-0:amd64 on system is 10.34-7+ubuntu18.04.1+deb.sury.org+1.
libpcre2-dev:amd64 depends on libpcre2-16-0 (= 10.21-1); however:
Version of libpcre2-16-0:amd64 on system is 10.34-7.
libpcre2-dev:amd64 depends on libpcre2-32-0 (= 10.21-1); however:
Version of libpcre2-32-0:amd64 on system is 10.34-7.
libpcre2-dev:amd64 depends on libpcre2-posix0 (= 10.21-1); however:
Package libpcre2-posix0 is not installed.
dpkg: error processing package libpcre2-dev:amd64 (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
libpcre2-dev:amd64
答案1
Focal Fossa 的官方存储库包含 liblibpcre2-8-0 v10.34-7。但是,您安装了 v10.34-7+ubuntu18.04.1+deb.sury.org+1,这显然是来自第三方来源。由于输出apt-cache policy libpcre2-8-0
显示您没有任何提供非官方版本的来源,因此您可以使用 apt 安装 v10.34-7。要安装,请运行
sudo apt install libpcre2-8-0=10.34-7