Python and OpenSSL version reference issue on OS X

蓝咒 提交于 2019-11-26 14:40:45

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

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

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

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

braddock

Use this as a workaround:

export CRYPTOGRAPHY_ALLOW_OPENSSL_098=1

This appears to be a recent check of the hazmat cryptography library. You can see the source code at:

https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/bindings/openssl/binding.py#L221

The CRYPTOGRAPHY_ALLOW_OPENSSL_098 environment variable downgrades the error to a deprecation warning, if you are willing to take the risk. I also ran into this on OS X in just the past day, so something changed recently.

This problem almost kills me!!!! Finally my guy solved this only by lowering the version of the package "paramiko" from 2.* to 1.*(like 1.15.4 I set)can solve!

If you are getting You are linking against OpenSSL 1.0.0 then use export CRYPTOGRAPHY_ALLOW_OPENSSL_098=1 environment variable to bypass it. Thanks @braddock

SOLVED NO HACKS, none of the above worked for me. I ended up taking a simpler and uncomplicated approach....

  1. Install python 2.7.13 from the official site, it actually installs as the default python, replacing the old python system wide.

https://www.python.org/downloads/mac-osx/

  1. Upgrade openssl after the python install.

sudo pip install --upgrade pyOpenSSL

  1. You will have to re-install all your python modules ( because you replaced python ), I strongly recommend using pip. After a few minutes of pip installs my default OSX python was upgraded, I had openssl upgraded, and I had all my modules ( including django running ).
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!