Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.5 with OpenSSL v > 1 MAC OSX Mojave

Openssl version of my mac and the python is not same. Openssl version of my mac is as following:

OpenSSL 1.0.2q  20 Nov 2018
built on: reproducible build, date unspecified
platform: darwin64-x86_64-cc

Where when i check it in python ssl.OPENSSL_VERSION I'm getting the following version: 'OpenSSL 0.9.8zh 14 Jan 2016'

I've tried brew but it's installing python 3.7 but I need 3.5. Tried installing it with pyenv but no luck, same version.

like image 597
Ali Sajid Avatar asked Jan 05 '19 11:01

Ali Sajid


People also ask

How do I install a specific version of Python on Mac terminal?

As an FYI: Python 3.4. 3_2 is $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/bd43f59bd50bb49242259f327cb6ac7a8dd59478/Formula/python3.rb and then python3. 4 -V should work. @MikeWilliamson just clone the repo and do a git log master -- Formula/python.

How do I install Python 3.5 on Mac?

Download Python either from https://www.python.org/ftp/python/3.5.0/python-3.5.0-macosx10.6.pkg or HomeBrew or via Anaconda from https://www.continuum.io/downloads . Show activity on this post. for your works like making virtual environments in that version. helps you manage you python versions.

How do I install Python 3.6 on Mac?

On MacOS, the recommended way to get Python 3. x on your machine is to use the HomeBrew utility. HomeBrew is a package manager similar to the PowerShell Gallery that allows users to download and install programs from a public repository.

Does Mac OS have Python 3?

macOS used to come with Python 2.7 pre-installed between versions 10.8 and 12.3. You are invited to install the most recent version of Python 3 from the Python website (https://www.python.org).


1 Answers

Finally after a long research, I've found the best way to solve it. You cannot resolve it with the brew install python just because it will install the latest python available. To install the specified version of the python you have to use homebrew-python. For example for python 3.5 you can install it like this:

brew install sashkab/python/python35

From their github page currently they have the following versions:

+----------------+-----------------+
| Python Version | Latest revision |
+----------------+-----------------+
| Python 2.7     | 2.7.15          |
| Python 3.5     | 3.5.6           |
| Python 3.6     | 3.6.8           |
| Python 3.7     | 3.7.2           |
+----------------+-----------------+

For some of you guys this may not work as on macos you should have proper CLI tools for this refer to this issue.

After all this make you virtual enviorment with python3.5 under the following directory on macos:

/usr/local/opt/python35/bin/python3.5

Try running the following commands in your python console to test the openssl version:

import ssl;
ssl.OPENSSL_VERSION

You'll get the v1 of OpenSSL. Which can also helps you to resolve the painfull Connection reset by peer issue too.

like image 165
Ali Sajid Avatar answered Sep 22 '22 03:09

Ali Sajid