Mac python3 pip3安装插件,出现ssl不可用

已有的环境:

Mac os

使用brew安装的python3.7

pip安装没有任何问题,但是本人想使用python3.

遇到的问题:

在使用pip3安装插件时,报错pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

解决思路:

1.在python3命令行中,import ssl后,出现错误:ImportError: dlopen(/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
  Reason: image not found.

2.网上百度说,可能是openssl有问题.于是:ls -al /usr/local/Cellar/openssl*

Mac python3 pip3安装插件,出现ssl不可用

之前进行过一些无脑操作,不知道对openssl有无更改.在上述情况下,使用brew switch openssl 1.0.2q,解决了问题.没有从根本上说明解决问题的原因,但是记录下自己的解决过程与环境情况,希望能帮到其他人.