在代理后面安装 tensorflow 或任何其他包时遇到问题:
第一次尝试:
运行命令:
pip install --upgrade tensorflow
输出:
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was
forcibly closed by the remote host', None, 10054, None))': /simple/tensorflow/
第二次尝试:
然后我在命令中提供了代理详细信息
>pip install --upgrade tensorflow --proxy http://user:passwd@xxx.xx.x.xx:80
输出错误:
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:83
3)'),)': /simple/tensorflow/
按照 pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)" 上的建议进行第三次尝试:
pip install --upgrade tensorflow --trusted-host pypi.org --trusted-host files.pythonhosted.org --proxy http://user:passwd@xxx.xx.x.xx:80
输出:
同上。
有人可以帮忙吗??
编辑:在 windows 机器上工作
最佳答案
我怀疑您可能需要在计算机上设置代理环境变量才能使用代理。尝试设置以下内容(假设您使用的是 Linux 或 Mac 操作系统):
export HTTP_PROXY=http://user:passwd@xxx.xx.x.xx:80
export HTTPS_PROXY=https://user:passwd@xxx.xx.x.xx:443
您不一定需要设置 HTTPS_PROXY
变量,但这样做也没什么坏处
然后尝试在没有标志的情况下运行
pip install tensorflow
关于python - 在代理后面使用 pip 安装任何包时出现 SSL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51077804/