为什么brew在安装php7时需要python

Erc*_*rce 5 php python homebrew dependencies

在 MacOs 上通过 brew 安装 php 时,我得到了下面的输出。所以我问为什么在安装php时需要python依赖?

==> Installing dependencies for php@7.4: python@3.9 and glib
==> Installing php@7.4 dependency: python@3.9
==> Pouring python@3.9-3.9.1_4.mojave.bottle.tar.gz
==> /usr/local/Cellar/python@3.9/3.9.1_4/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.9/3.9.1_4/bin/pip3 install -v --global-option=--no-user-cfg --install-option=--force --install-option=--single-version-externally-managed --install-option=--record=installed.txt --upgrade --target=/usr/local
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
  /usr/local/Cellar/python@3.9/3.9.1_4: 3,932 files, 61.7MB
==> Installing php@7.4 dependency: glib
==> Pouring glib-2.66.4_1.mojave.bottle.1.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
  /usr/local/Cellar/glib/2.66.4_1: 441 files, 20.3MB
==> Installing php@7.4
Run Code Online (Sandbox Code Playgroud)

Rap*_*tor 1

我知道这个问题有些年头了,但我只是想回答一下。

\n
\n

在 Homebrew 中,php@7.4取决于python@3.9,这是因为:

\n
    \n
  1. php@7.4不依赖于python@3.9. brew deps --tree php@7.4请参阅下面的输出
  2. \n
  3. Homebrew 在某些情况下需要 Python(并且会不时更新版本)(请阅读此内容),因为它不使用系统 Python 版本。
  4. \n
\n

结论:Homebrew 需要 Python,而不是 PHP 7.4。

\n

输出brew deps --tree php@7.4

\n
php@7.4\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 apr\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 apr-util\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 apr\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 argon2\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 aspell\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 autoconf\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 m4\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 curl\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 brotli\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libidn2\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libunistring\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 gettext\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libnghttp2\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libssh2\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openldap\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 rtmpdump\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 freetds\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 unixodbc\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libtool\n\xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 m4\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 gd\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 fontconfig\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 freetype\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 freetype\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libavif\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 aom\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-xl\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 brotli\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 giflib\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 highway\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 imath\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 little-cms2\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libtiff\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openexr\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 imath\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 webp\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 giflib\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libtiff\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82               \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82               \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libvmaf\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libtiff\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 webp\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 giflib\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libpng\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libtiff\n\xe2\x94\x82           \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 jpeg-turbo\n\xe2\x94\x82           \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82               \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82               \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 gettext\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 gmp\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 icu4c\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 krb5\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libpq\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 krb5\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libsodium\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libzip\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 zstd\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lz4\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 xz\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 oniguruma\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openldap\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 openssl@3\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 openssl@1.1\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ca-certificates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pcre2\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 sqlite\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 readline\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 tidy-html5\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 unixodbc\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libtool\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 m4\n
Run Code Online (Sandbox Code Playgroud)\n

或者,如果您更喜欢在浏览器中显示的图形版本,则可以使用以下命令:

\n
brew deps --graph php@7.4\n
Run Code Online (Sandbox Code Playgroud)\n

最后,如果您只想查看所有依赖项的摘要,可以使用以下命令:

\n
brew deps php@7.4\n
Run Code Online (Sandbox Code Playgroud)\n