我正在尝试更新在 MacOS El Capitan 上运行的 Python 3.5 的 OpenSSL。我已经通过以下命令安装了新版本:
brew install openssl
我在 shell 上得到了以下内容:
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2g: 1,678 files, 12.0M
然后,我检查 shell 上的版本:
$ python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 0.9.8zh 14 Jan 2016
$ openssl version
OpenSSL 1.0.2o 27 Mar 2018
OpenSSL 似乎有两个版本,Python 继续使用最旧的版本。我需要获取 OpenSSL 的更新版本来运行 Python 程序,但我不知道如何使 Python 使用最新版本。我也不知道如何使用用brew安装新版本后提供的信息。
任何帮助将不胜感激!
最佳答案
我找到了这个问题的解决方案! 重点是 Python 3.5 可以与 OpenSSL 0.9.8 配合使用。解决方案是安装具有特定配置的 Python 3.6.5,以包含“OpenSSL 1.0.2n 7 Dec 2017”。
brew install openssl
brew link openssl --force # if you need too
brew install python3 --with-brewed-openssl # this brings Python 3.6.5, and not 3.5
关于python - 在 macOS X Capitan 中更新 OpenSSL for python 3.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50078384/