我对Python很陌生,并试图在Windows 7上> pip install linkchecker
。一些注释:
> pip install scrapy
也会导致SSL错误。python
和pip
在我安装3.4.1之前无法从命令行获得。> pip search linkchecker
有效。也许这是因为pip search没有验证站点的SSL证书。以下是运行pip install linkchecker
后mypip.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
可以使用以下参数指定证书:
见:Docs » Reference Guide » pip
如果指定公司的根证书不起作用,那么cURL证书可能会起作用:http://curl.haxx.se/ca/cacert.pem
必须使用PEM文件而不是CRT文件。如果你有一个CRT文件,你需要convert the file to PEM注释中有报告说现在可以使用CRT文件,但是我还没有验证。
还要检查:SSL Cert Verification。
通过将^{} 和^{} 设置为受信任主机,可以忽略SSL错误。
注意:在2018年4月的某个时候,Python Package Index从
pypi.python.org
迁移到pypi.org
。这意味着使用旧域的“受信任主机”命令不再工作。永久固定
由于pip 10.0的发布,您应该能够通过升级
pip
本身来永久地修复这个问题:或者通过reinstalling it获取最新版本:
(…然后使用相关的Python解释器运行
get-pip.py
)。pip install <otherpackage>
应该在这之后工作。如果没有,那么您将需要做更多,如下所述。你可能想add the trusted hosts and proxy to your config file。
pip.ini
(Windows)或pip.conf
(unix)替代解决方案(不太安全)
大多数答案都可能会带来安全问题。
帮助轻松安装大多数python包的两个解决方案是:
easy_install <package_name>
。请注意,某些包将找不到或会出现小错误。pip install wheel_package_name.whl
安装软件包。kenorb’s answer非常有用(非常好!)。
在他的解决方案中,也许这是最简单的一个:
--trusted-host
例如,在这种情况下,您可以
pem文件(或任何其他文件)是不必要的。
相关问题 更多 >
编程相关推荐