brew upgrade引发的ssl小问题

brew upgrade

今天手哆嗦了一下,brew upgrade打出去了,然后开始自动更新所有的包……

过了一会需要写代码了,打开pycharm
Referenced from: ~/.pyenv/versions/3.6.9/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so

以为缺少了ssl模块,就pip install ssl

Collecting ssl
  Could not fetch URL https://pypi.org/simple/ssl/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ssl/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ssl/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ssl/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ssl/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ssl/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ssl/
  Could not find a version that satisfies the requirement ssl (from versions: )
No matching distribution found for ssl
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

自己是Mac,想了想,之前没啥事怎么突然电脑就出问题了呢,好像brew操作了?!


这期间各种谷歌、百度、搜索


好像ssl都跟openssl相关,就搜索brew --prefix openssl

image.png

嗯啥时候多了个版本的


brew list.png

好吧,都是我的错不该更新所有的软件(关键是我不知道呀)

因为python是编译安装的,是基于上一次编译的系统环境编译的,那么这次我的python出问题就是因为系统环境出了点问题,所以我选择重新编译python
之前还测试了好几遍……


test.png

解决办法:

  • 自己是用pyenv管理多个python环境,所以根据之前配置好的pyenv直接
    删除(记得备份自己常用的模块包pip freeze > requirements.txt)
  • 然后pyenv uninstall 3.6.9
    这个时候你基于3.6.9的环境会提示要不要删除,
    pyenv uninstall.png

    我无所谓就删除了,谁测试下不删有没有影响呢
  • 然后重新安装pyenv install 3.6.9
    pyenv install.png

果然,用的是我brew upgrade之后的系统环境

后记

记得以后不要随随便便就更新所有的软件(抽它抽它-手:招你惹你了……),影响其他软件的软件最好锁定了
brew pin [email protected]
需要更新的时候主动放开unpin

  • 以后在更新之前,用 brew outdated 查看哪些包可以更新
    brew outdated
  • 最好指定你想要更新的某个软件
    brew upgrade 指定包名
  • 当然了还有更新所有的包
    brew upgrade # 猥琐发育,别浪啦
    brew upgrade all.png

python2已经不更新了,除了系统自带python2,自己安装都是python3

你可能感兴趣的:(brew upgrade引发的ssl小问题)