【发布时间】:2017-11-01 12:07:43
【问题描述】:
我对 Python 非常陌生,并尝试在 Windows 7 上 > pip install linkchecker。一些注意事项:
- 无论软件包如何,pip 安装都失败。例如,
> pip install scrapy也会导致 SSL 错误。 - Python 3.4.1 的香草安装包括 pip 1.5.6。我尝试做的第一件事是安装链接检查器。 Python 2.7 已经安装,它随 ArcGIS 一起提供。在我安装 3.4.1 之前,
python和pip在命令行中不可用。 -
> pip search linkchecker有效。可能是因为 pip search 没有验证网站的 SSL 证书。 - 我在公司网络中,但我们不通过代理访问 Internet。
- 每台公司计算机(包括我的)都有一个受信任的根证书颁发机构,用于各种原因,包括启用对https://google.com 的 TLS 流量监控。不确定这是否与此有关。
这是运行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
【问题讨论】:
-
恰恰相反! Python 3.4.1 及更早版本默认不进行证书验证。如果您使用的是 Python 3.4.2,我会认为这就是问题所在。 (请参阅issue 21013 和this thread on the mailing list。请注意,这是一个很长的线程的开始。)对不起,我真的帮不上忙!
-
检查你是否打开并关闭了 fiddler。 Fiddler 尝试破坏 SSL,这会破坏 pip,当我关闭 fiddler pip 对我有用时。 When I close my fiddler everything goes ok
-
您应该重新安装包含 Python 的 Xcode 命令行工具。 stackoverflow.com/a/68247505/4067700