1

I was working with Steffen Ullrich on a previous issue, and now it is morphing into a new issue. So taking his advice (thank you Steffen), I am posting a separate question:

$ python -c 'import ssl; print ssl.OPENSSL_VERSION'
OpenSSL 0.9.8zh 14 Jan 2016

I have attempted just about everything under the sun (so it feels) to fix it.

$ brew install openssl
Warning: openssl 1.0.21 is already installed

So I have both, but it only reads/links to OpenSSL 0.9.8zh?

I am new to Python/Homebrew on my Mac.

bfontaine
  • 18,169
  • 13
  • 73
  • 107
KaiArtax
  • 29
  • 4
  • [How do I install pyOpenSSL on Mac OS X?](http://stackoverflow.com/q/14361569), [Updating openssl in python 2.7](http://stackoverflow.com/q/18752409), [Python referencing old SSL version](http://stackoverflow.com/q/24323858), [Python and OpenSSL version reference issue on OS X](http://stackoverflow.com/q/37690054), [Python 3.3 and Installing PyOpenSSL on a Mac](http://stackoverflow.com/q/21899573), [Using Python with homebrew on OS X](http://stackoverflow.com/q/25441252), etc... – jww Jul 14 '17 at 18:53

2 Answers2

0

You also need to install Python that is linked to that Homebrew OpenSSL library, try with:

brew install python --with-brewed-openssl

Beware, tho, that it will not replace your 'native' Python, you'll have to relink it. By default, it will be installed in /usr/local/Cellar/python/<version>, whereas the version may change with time. If you want you can relink the python binary as:

sudo mv /usr/bin/python /usr/bin/python.old 2>/dev/null
sudo ln -s -f /usr/local/Cellar/python/<version>/bin/python /usr/bin/python

But I'd suggest you to create a local link so you can use both python versions:

sudo mv /usr/local/bin/python /usr/local/bin/python.old 2>/dev/null
sudo ln -s -f /usr/local/Cellar/python/<version>/bin/python /usr/local/bin/python

(of course, replacing the <version> with whichever version of Python Homebrew installed at the time of trying the above)

And then when you need this 'upgraded' Python just launch your scripts with /usr/local/bin/python script.py or use /usr/local/bin/python as their shebang.

zwer
  • 24,943
  • 3
  • 48
  • 66
  • `$ brew install python --with-brewed-openssl` `Warning: python 2.7.13 is already installed` **Next was:** `$ sudo mv /usr/local/bin/python /usr/local/bin/python.old 2>/dev/null` `$ sudo ln -s -f /usr/local/Cellar/python/2.7.13/bin/python` `/usr/local/bin/python` **Result:** `$ python -c 'import ssl; print ssl.OPENSSL_VERSION' OpenSSL 0.9.8zh 14 Jan 2016` **Am I missing something?** – KaiArtax Jul 14 '17 at 21:01
  • Yes, you're calling the old, _built-in_ python binary - try: `/usr/local/bin/python -c 'import ssl; print ssl.OPENSSL_VERSION'` – zwer Jul 14 '17 at 21:30
  • $ /usr/local/bin/python -c 'import ssl; print ssl.OPENSSL_VERSION' OpenSSL 1.0.2l 25 May 2017 I think you might have just solved both of the issues I posted questions about...Thank you very much. – KaiArtax Jul 15 '17 at 00:55
0

Incase anyone else has the same issues, I wanted to provide the link to the original (1st half of the issue) so that others may get a full picture.

macOS Sierra/Python2.7.13 URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:661)>

KaiArtax
  • 29
  • 4