安装包模块出现的下载源问题解决:An HTTPS request has been made /Could not find a version that satisfies the requirement pyopenssl

pip install --user --upgrade pip

出现问题一:

SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. 

解决方法:pip install pyopenssl ndg-httpsclient pyasn1

又出现问题二:

ERROR: Could not find a version that satisfies the requirement pyopenssl (from versions: none)

ERROR: No matching distribution found for pyopenssl

分析
此错误的最可能原因是:

1.因为PyPI服务器已将您的IP地址列入黑名单,因此未响应您的请求。
这可以通过将代理与pip一起使用来解决。请参阅解决方案。

2.或者是因为你在运行一个旧的pip(特别是在mac上)。这可以通过升级pip来解决。

3.这也可能是因为pypi服务器已关闭。

解决方案
在windows下pip配置代理,可以解决这个问题。

点击此电脑,在最上面的的文件夹窗口输入 : %APPDATA%
按回车跳转到目标目录,在此目录下新建pip文件夹。
在pip文件夹下创建pip.ini文件(注意如果用记事本创建,要删除末尾的".txt")。
打开.ini文件,输入以下内容,关闭即可(注意:源镜像可替换)。
[global]

imeout = 6000

index-url = http://pypi.douban.com/simple

trusted-host = pypi.douban.com

国内源镜像有:

V2EX:http://pypi.v2ex.com/simple
豆瓣:http://pypi.douban.com/simple
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple

配置好代理后,再次执行指令运行成功如下图所示。
C:Python27Scripts>pip install pyopenssl ndg-httpsclient pyasn1

发现成功

原文地址:https://www.cnblogs.com/alex-13/p/15208179.html