首页 > 解决方案 > 无法使用 pip 安装软件包(SSL:CERTIFICATE_VERIFY_FAILED)

问题描述

我一直无法下载任何软件包,pip并且我不断收到关于确认 SSL 证书问题的相同错误。我目前在我大学的网络上,我的笔记本电脑上也安装了 Anaconda。我不确定这两个因素是否与这个问题有关。

我正在使用python版本3.7.0pip版本9.0.1pip3版本10.0.1

当我pip install django在终端中输入时,我得到了这个结果:

Collecting django
  Could not fetch URL https://pypi.python.org/simple/django/:
     There was a problem confirming the ssl certificate: 
     [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
     - skipping
  Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django

我已经阅读了其他几个主题。我试过这样的命令但没有成功:

curl https://bootstrap.pypa.io/get-pip.py | python3
pip install --upgrade pip
pip install --trusted-host pypi.org --trusted-host \
  files.pythonhosted.org django

标签: pythondjangopython-3.xpip

解决方案


根据这个问题,您还应该作为受信任的主机添加pypi.python.org到命令行,即:

pip install --trusted-host pypi.org --trusted-host pypi.python.org \
            --trusted-host files.pythonhosted.org django

推荐阅读