Python (pyenv) 编译错误 - 在 mac os x 上缺少 OpenSSL

eri*_*ric 2 python openssl amazon-web-services macos-mojave

我正在尝试在 macOS Mojave 10.14 上安装 AWS EB-CLI,并且在编译 Python 时遇到以下错误。

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?  

BUILD FAILED (OS X 10.14.5 using python-build 20180424)
Run Code Online (Sandbox Code Playgroud)

在 pyenv wiki 中,它说,

  1. 安装额外的 SDK 头文件——我做到了
  2. 编译 Python 时需要 libssl-dev ....

到目前为止我所做的事情...

  • 通过 brew 安装 OpenSSL
  • 上面的符号链接到 /user/lib
  • 通过 brew 安装 xz(由于找不到“lzma.h”文件错误)

现在错误是:

could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
Run Code Online (Sandbox Code Playgroud)

我正在从 Windows 迁移到 Mac 并且很难理解这一点。任何帮助将非常感激。

eri*_*ric 5

找到了答案。

CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)"

成功了

更多信息@ https://github.com/pyenv/pyenv/issues/1184