我对Python非常陌生,并试图在Windows 7上安装链接检查器。一些注意事项:

pip install is failing no matter the package. For example, > pip install scrapy also results in the SSL error. Vanilla install of Python 3.4.1 included pip 1.5.6. The first thing I tried to do was install linkchecker. Python 2.7 was already installed, it came with ArcGIS. python and pip were not available from the command line until I installed 3.4.1. > pip search linkchecker works. Perhaps that is because pip search does not verify the site's SSL certificate. I am in a company network but we do not go through a proxy to reach the Internet. Each company computer (including mine) has a Trusted Root Certificate Authority that is used for various reasons including enabling monitoring TLS traffic to https://google.com. Not sure if that has anything to do with it.

下面是运行pip install linkchecker后我的pip.log的内容:

Downloading/unpacking linkchecker
  Getting page https://pypi.python.org/simple/linkchecker/
  Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
  Getting page https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'http.client.CannotSendRequest'>: Request-sent)
  Will skip URL https://pypi.python.org/simple/ when looking for download links for linkchecker
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for linkchecker:
  * https://pypi.python.org/simple/linkchecker/
  Getting page https://pypi.python.org/simple/linkchecker/
  Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
  Could not find any downloads that satisfy the requirement linkchecker
Cleaning up...
  Removing temporary dir C:\Users\jcook\AppData\Local\Temp\pip_build_jcook...
No distributions at all found for linkchecker
Exception information:
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python34\lib\site-packages\pip\req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Python34\lib\site-packages\pip\index.py", line 277, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for linkchecker

当前回答

或者,如果什么都不行(就像我的情况),你可以恢复到搜索和下载whl文件这里:

https://pypi.org/project/fileDownloader.py/

在通过pip安装它之前,使用下载的文件,不再需要任何证书:

python3.7 -m pip install Myfile.whl

其他回答

我最近遇到了这个问题,因为我公司的网页内容过滤器使用自己的证书颁发机构,以便它可以过滤SSL流量。在我的情况下,PIP似乎没有使用系统的CA证书,产生了您提到的错误。后来,将PIP降级到1.2.1版本也出现了一系列问题,所以我回到了Python 3.4附带的原始版本。

我的解决方法非常简单:使用easy_install。要么它不检查certs(就像旧的PIP版本一样),要么它知道使用系统certs,因为它每次都对我有效,我仍然可以使用PIP卸载安装在easy_install中的包。

如果这不起作用,并且您可以访问没有问题的网络或计算机,您总是可以设置自己的个人PyPI服务器:如何在没有镜像的情况下创建本地自己的PyPI存储库索引?

在尝试使用easy_install作为最后的努力之前,我几乎是这样做的。

我也遇到过类似的问题。对我有效的解决方法 1)卸载python 2.7 2)删除python27文件夹 3)重新安装最新的python

答案非常相似,而且有点令人困惑。在我的案例中,我公司网络中的证书是问题所在。我能够使用以下方法来解决这个问题:

pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org oauthlib -vvv

如图所示。如果不需要详细输出,-vvv参数可以省略

到现在为止,当pip升级到10,现在他们已经把路径从pypi.python.org更改为files.pythonhosted.org 请将命令更新为pip——trusted-host files.pythonhosted.org install python_package

你可以试着忽略“https”:

pip install --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org  [your package..]