Feb. 2020
Uninstall the following Python installations if they exist:
/Applications/Python/
/User/$USER/Library/Python/
Verify PATH
/etc/path
~/.bshrc
~/.bash_profile
~/.zshrc
~/.zsh_profile
~/.profile
Make sure python
and python3
are installed via brew
# Python 2 removed from brew in Feb 2020 (EOL Jan 1)
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3a877e3525d93cfeb076fc57579bdd589defc585/Formula/python@2.rb
# Python 3
brew install python
Install both versions of OpenSSL (1.0 and 1.1)
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
brew install openssl
Exact patch versions may differ, but your /usr/local/opt/
directory should have the following:
$ ll /usr/local/opt | grep openssl
lrwxr-xr-x 1 dfrakes admin 24B Feb 26 09:46 openssl -> ../Cellar/openssl/1.0.2t
lrwxr-xr-x 1 dfrakes admin 24B Feb 26 09:44 openssl@1.0 -> ../Cellar/openssl/1.0.2t
lrwxr-xr-x 1 dfrakes admin 28B Feb 25 09:04 openssl@1.1 -> ../Cellar/openssl@1.1/1.1.1d
Set up symlink
# For Python 2
ln -s /usr/local/Cellar/openssl/1.1.1d /usr/local/openssl
# For Python 3
ln -s /usr/local/Cellar/openssl/1.0.2t /usr/local/openssl
Problem:
Not sure which python
I'm using.
Solution:
which python
--
Problem:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Solution:
brew uninstall --ignore-dependencies openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
--
Problem: Can't install psycopg2
...
ld: warning: directory not found for option '-L/usr/local/opt/openssl@1.1/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/USERNAME/.virtualenv/ooew/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/td/vvm9nzg173g2vrrvywlpwtv00000gr/T/pip-build-fws6ej0b/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/td/vvm9nzg173g2vrrvywlpwtv00000gr/T/pip-7g38lwkh-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/USERNAME/.virtualenv/ooew/include/site/python3.6/psycopg2" failed with error code 1 in /private/var/folders/td/vvm9nzg173g2vrrvywlpwtv00000gr/T/pip-build-fws6ej0b/psycopg2/
Solution:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2