2020/02/06

pipでsslモジュールが使えないと言われた場合の対処法

何がきっかけかわからないが,あるとき突然pipができなくなってしまった.
エラーは以下の通りで,sslモジュールが使えないと言われる.

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

ググると,opensslを入れ直せと出てくるが,

brew update
brew upgrade
brew uninstall --ignore-dependencies openssl
brew install openssl

とかしてみてもだめ.
色々試行錯誤の結果,以下で行けたように見えた.

brew uninstall --ignore-dependencies openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

しかし,今度はsshができなくなる.
エラー内容はこんな感じ.
dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib


最終的に以下で行けた.

brew switch openssl 1.0.2t