python - 在 macOS X Capitan 中更新 OpenSSL for python 3.5

标签 python macos openssl

我正在尝试更新在 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/

相关文章:

python - 当半衰期已知时,如何填充药物不规则时间序列的缺失值

java - WebDriverException : unknown error: failed to change window state to maximized, 当前状态对于 MAC OS X 上的 Chrome 70 和 Chromedriver 2.43 是正常的

ios - 如何在重写方法中强制调用 super

c++ - C++ 应用程序中的 openssl 错误 SSL_ERROR_SSL

python - 在 Windows 上安装 scipy 包时出错

python - 使用 OptionParser 与 sys.argv

python - 分水岭分割后提取对象

OS X 上的 Python 和 OpenSSL 版本引用问题

cryptography - 如何使用 X509 证书(通过简单验证签署文件,+其他问题)

android - 如何在 Android/Linux 上构建 OpenSSL?