pip 和可信主机

问题描述 投票:0回答:1

我正在尝试使用 Python 3.8.6 在 Windows 10 上安装 PyTorch 1.7.0。当简单地输入命令时

pip install torch==1.7+cu101

我收到错误:

'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1124)'))': /whl/torch_stable.html

当我这样做时:

pip install --trusted-host download.pytorch.org torch==1.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

安装完美无缺。

但是,我愿意:

  • 理想情况下,使用简单的
    pip
    命令来处理该问题并让 SSL 验证发挥作用
  • 通过位于我的虚拟环境中的
    pip
    配置文件来处理该问题,即
    /path/to/my/env/pip.conf

不幸的是,有这样的

pip.conf
文件:

trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org
               download.pytorch.org

不起作用,似乎被

pip

忽略
windows pip pytorch
1个回答
0
投票

C:\Users\AppData\Roaming\pip\pip.ini 我看到它存储在 Windows Server 中。

如果您运行此命令,请说:

pip config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org"

它将更新上述文件。

© www.soinside.com 2019 - 2024. All rights reserved.