非常感谢@facetoe;可悲的是,正如其他人所说,此提交取消了功能https://github.com/Homebrew/homebrew-core/commit/c55743ce2e993d3407a7f7932abfe4910a25f953#diff-c290cd53a44f82f9ba1f4d59d9f90140。最终我想要最新的只用python;对我来说最快的方法是:
git clone https://github.com/Homebrew/homebrew-core.git
cd homebrew-core/
vi Formula/postgresql.rb
在这里,您需要将 python 的环境变量和--with-python
args 列表添加到安装块中。我对当前主人的区别是:
@@ -38,6 +38,7 @@ class Postgresql < Formula
def install
ENV.prepend "LDFLAGS", "-L#{Formula["openssl@1.1"].opt_lib} -L#{Formula["readline"].opt_lib}"
ENV.prepend "CPPFLAGS", "-I#{Formula["openssl@1.1"].opt_include} -I#{Formula["readline"].opt_include}"
+ ENV["PYTHON"] = which("python3")
args = %W[
--disable-debug
@@ -56,6 +57,7 @@ class Postgresql < Formula
--with-libxslt
--with-openssl
--with-pam
+ --with-python
--with-perl
--with-tcl
--with-uuid=e2fs
然后最后你想安装它:
brew install --build-from-source ./Formula/postgresql.rb
sudo install_name_tool -change @rpath/Python3.framework/Versions/3.8/Python3 /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/Python /usr/local/lib/postgresql/plpython3.so
brew services start postgresql