OS X 上的 Python 和 OpenSSL 版本参考问题 [英] Python and OpenSSL version reference issue on OS X

查看:22
本文介绍了OS X 上的 Python 和 OpenSSL 版本参考问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在尝试解决我遇到的 OpenSSL 版本问题.

Trying to resolve an OpenSSL version issue I'm having.

我的 Mac 上似乎有三个不同版本的 OpenSSL.

It seems that I have three different versions of OpenSSL on my Mac.

  1. Python 2.7.11 版本为 0.9.7m:

  1. Python 2.7.11 has version 0.9.7m:

python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 0.9.7m 23 Feb 2007

  • 在终端:

  • At the Terminal:

    openssl version
    OpenSSL 1.0.1h 5 Jun 2014
    

  • 最近编译/安装:

  • Recently Compiled / Installed:

    /usr/local/ssl/bin/openssl
    OpenSSL> version
    OpenSSL 1.0.2h  3 May 2016
    OpenSSL>
    

  • 我最近将我的 OS X 升级到 10.11.5.在此过程中,导致以前工作的 python 脚本出现问题.以下是错误消息片段:

    I recently upgraded my OS X to 10.11.5. In the process, caused an issue for previously working python scripts. Below is the error message snippet:

    Python 错误信息:

    Python Error Message:

     You are linking against OpenSSL 0.9.8, which is no longer *
     RuntimeError: You are linking against OpenSSL 0.9.8, which is no longer support by the OpenSSL project. You need to upgrade to a newer version of OpenSSL.
    

    (* - 是的,这就是错误信息的样子.它在句子中间被剪掉了.)

    (* - yes, this is how the error message looks like. It's trimmed in the middle of the sentence.)

    对于解决此问题的任何建议,我们将不胜感激.我想要的是让 Python 参考 OpenSSL 版本 1.0.2h 与过时的版本 0.9.7m.

    Any recommendations on resolving this issue would be greatly appreciated. What I'd like is to have Python reference the OpenSSL version 1.0.2h vs the outdated version 0.9.7m.

    我多次尝试安装 Python 和 OpenSSL,使用各种帖子/博客作为指导,但没有任何运气.

    I've tried installing Python and OpenSSL many times using various post / blogs for guidance without any luck.

    推荐答案

    您可以安装使用较新版本 openssl 的 python 版本.

    You can install a version of python that uses a newer version of openssl.

    首先你可以brew安装一个新版本的open SSL

    First you can brew install a new version of open SSL

    brew update
    brew install openssl
    brew link --force openssl
    

    您应该会看到更新的版本

    You should see a newer version with

    openssl version -a
    

    然后您可以安装不同版本的 python,它使用较新版本的 openssl.如果您使用 pyenv,那就是:

    Then you can install a different version of python which uses that newer version of openssl. If you use pyenv, that would be:

    CFLAGS="-I$(brew --prefix openssl)/include" 
    LDFLAGS="-L$(brew --prefix openssl)/lib" 
    pyenv install -v 3.4.3
    

    您可以在此处找到有关使用 brew 安装版本的 openssl 安装 python 版本的更多信息:https://github.com/yyuu/pyenv/wiki/Common-build-problems

    You can find more information about installing a version of python with a brew installed version of openssl here: https://github.com/yyuu/pyenv/wiki/Common-build-problems

    这篇关于OS X 上的 Python 和 OpenSSL 版本参考问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆