pip安装失败,出现"连接错误。[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败(_ssl.c:598)&quot。

我是Python的新手,试图在Windows 7上> pip安装linkchecker。一些注意事项。

  • 无论哪个软件包,pip安装都是失败的。例如,> pip install scrapy也会导致SSL错误。
  • Vanilla安装的Python 3.4.1包括pip 1.5.6。我尝试做的第一件事是安装linkchecker。Python 2.7已经安装好了,它是ArcGIS自带的。在我安装3.4.1之前,pythonpip在命令行中是不可用的。
  • > pip search linkchecker可以使用。也许这是因为pip搜索没有验证网站的SSL证书。
  • 我在一个公司的网络中,但我们不通过代理来访问互联网。
  • 每个公司的计算机(包括我的)都有一个受信任的根证书颁发机构,用于各种原因,包括启用监控TLS流量到https://google.com。不知道这是否与此有关系。

下面是我运行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

你可以用这个参数指定一个证书。

pip --cert /etc/ssl/certs/FOO_Root_CA.pem install linkchecker

见。Docs » Reference Guide » pip

如果指定你公司的根证书不起作用,也许cURL的证书会起作用: http://curl.haxx.se/ca/cacert.pem

你必须使用PEM文件而不是CRT文件。如果你有一个CRT文件,你将需要将文件转换为PEM评论里有报告说这现在可以用CRT文件,但我没有验证过。

还请检查。SSL证书验证

评论(11)

你可以尝试通过使用http而不是https来绕过SSL错误。当然,这在安全方面不是***的最佳选择,但如果你很匆忙的话,应该可以做到这一点。

pip install --index-url=http://pypi.python.org/simple/ linkchecker
评论(9)

我通过删除我的pip和安装旧版本的pip解决了这个问题。 https://pypi.python.org/pypi/pip/1.2.1

评论(5)