Updating openssl in python 2.7

前端 未结 6 1285
醉酒成梦
醉酒成梦 2020-11-22 15:17

wondering if someone may please explain how openssl works in python2.7. I\'m not sure if python got its own openssl or picks it up from local machine/env?

let me exp

6条回答
  •  野性不改
    2020-11-22 16:22

    Please refer to http://rkulla.blogspot.kr/2014/03/the-path-to-homebrew.html

    After upgrading openssl to 1.0.1j by homebrew on MAC, but system python still referred to old version 0.9.8. It turned out the python referred to openssl. So I have installed new python with brewed openssl and finished this issue on Mac, not yet Ubuntu.

    On Mac OS X version 10.10 and system python version 2.7.6, my procedure is as follows:

    $ brew update
    
    $ brew install openssl
    

    Then you can see openssl version 1.0.1j.

    $ brew link openssl --force 
    
    $ brew install python --with-brewed-openssl    
    

    You have to install new python with brewed openssl. Then, you can see /usr/local/Cellar/python/2.7.8_2/bin/python.

    $ sudo ln -s /usr/local/Cellar/python/2.7.8_2/bin/python /usr/local/bin/python

    Of course, /usr/local/* should be owned by $USER, not root, which is told by Ryan, but I used 'sudo'. And, before this instruction, I didn't have /usr/local/bin/python. After this instruction, you can use python version 2.7.8 not 2.7.6.

    Finally, you can see as belows;

    $ python --version  
    Python 2.7.8
    
    $ python -c "import ssl; print ssl.OPENSSL_VERSION"
    OpenSSL 1.0.1j 15 Oct 2014
    

    Till now, I'm working on it on Ubuntu 12.04. If I have a solution for Ubuntu 12.04, then I will update my answer. I hope this procedure help you.

提交回复
热议问题