【问题标题】:Updating OpenSSL in macOs X Capitan for python 3.5在 macOS X Capitan 中为 python 3.5 更新 OpenSSL
【发布时间】:2018-04-28 15:55:05
【问题描述】:

我正在尝试为在 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 macos openssl


    【解决方案1】:

    我得到了这个问题的解决方案! 关键是 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 3.4,然后才能执行 brea install python3 --with-brewed-openssl 以引入 python 3.6.5?
    • 没有。这是没有必要的。两个版本可以共存。当我使用 PyCharm 时,我必须在开始一个新项目时选择 Python 版本。够了。
    猜你喜欢
    • 1970-01-01
    • 2015-05-16
    • 1970-01-01
    • 2018-04-11
    • 2013-09-16
    • 2016-08-30
    • 2016-05-09
    • 2016-11-23
    • 2013-02-17
    相关资源
    最近更新 更多