使用pip更新模块遇到问题

首先 使用 requests包进行http请求的时候总是报错
Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)'

分析是 pyOpenssl 模块的问题,pyOpenssl的版本太低了。于是更新pyOpenssl。
但是遇到问题:
Could not find a version that satisfies the requirement cryptography>=2.2.1 (from pyOpenSSL==18.0.0) (from versions: ) No matching distribution found for cryptography>=2.2.1 (from pyOpenSSL==18.0.0)
经查,发现requirements.txt 文件的问题
执行 pip freeze > requirements.txt
又遇到问题:
Cannot uninstall 'pyOpenSSL'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

经查是 maxOS的预装的six库的问题。(Apple这个six也真是666,导致很多bug,详见:https://github.com/pypa/pip/issues/3165)

要执行 忽略six的命令,更新pyOpenssl
sudo -H pip install pyOpenSSL --upgrade --ignore-installed six
终于好了

你可能感兴趣的:(使用pip更新模块遇到问题)