$ sudo apt install php8.1-bcmath
Reading package lists... Done
Building dependency tree... Done
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:
php8.1-bcmath : Depends: php8.1-common (= 8.1.2-1ubuntu2.14) but 8.1.18-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
我确实有 8.1.18-1+ubuntu18.04.1,但看不到升级到 8.1.2-1ubuntu2.14 的方法。我已运行 apt update 和 apt upgrade。当我尝试重新安装 php 时,我收到以下信息:
$ sudo apt reinstall php8.1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reinstallation of php8.1 is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
答案1
您正在使用deb.sury.org
PHP 存储库/PPA。
该bcmath
库在 sury.org 存储库中不可用deb.sury.org
,并且仅作为 Ubuntu 存储库的一部分提供。您不能将 Ubuntu 存储库中的 PHP 8.1 软件包与存储库的核心 PHP 库混合搭配。
要么deb.sury.org
存储库需要提供 的升级版本php8.1-bcmath
,要么您必须删除deb.sury.org
PHP 存储库并从 Ubuntu 存储库恢复到 8.1.2 PHP。
这里没有其他“混合”解决方案。