1

安装 bcmath 时出现以下错误

root@cfe90ea33de0:/var/www/web# apt install php-bcmath
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-bcmath is a virtual package provided by:
  php7.3-bcmath 7.3.14-1~deb10u1 [Not candidate version]
  php7.3-bcmath 7.3.11-1~deb10u1 [Not candidate version]
  php7.0-bcmath 7.0.33-0+deb9u7 [Not candidate version]
  php7.0-bcmath 7.0.33-0+deb9u6 [Not candidate version]

E: Package 'php-bcmath' has no installation candidate

我尝试使用以下命令仍然是同样的错误

apt-get install php7.3-bcmath
apt-get install php7.0-bcmath
V=`php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\).*$/\1/'` \apt-get install php$V-bcmath
4

2 回答 2

17
docker-php-ext-install bcmath

登录 Docker 后,上述命令有效。

于 2020-03-02T06:56:00.590 回答
2
RUN docker-php-ext-install bcmath

将此添加到您的 Docker 文件中并重建 docker 映像。

于 2021-12-20T19:38:59.473 回答