发布于2019-08-21 12:01 阅读(608) 评论(0) 点赞(4) 收藏(0)
我是Python的新手,并试图> pip install linkchecker
在Windows 7上。一些说明:
> pip install scrapy
也会导致SSL错误。python
而pip
直到我安装3.4.1中不具备的命令行。> pip search linkchecker
作品。也许这是因为pip搜索不会验证网站的SSL证书。以下是运行后我的pip.log的内容pip install linkchecker
:
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
您可以通过设置pypi.org
和files.pythonhosted.org
作为可信主机来忽略SSL错误。
$ pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
注意:在2018年4月的某个时间,Python Package Index已迁移pypi.python.org
到pypi.org
。这意味着使用旧域的“trusted-host”命令不再起作用。
自从pip 10.0发布以来,你应该能够通过pip
自我升级来永久修复它:
$ pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip setuptools
或者只是重新安装它以获得最新版本:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
(...然后get-pip.py
使用相关的Python解释器运行)。
pip install <otherpackage>
应该在此之后工作。如果没有,那么您将需要做更多,如下所述。
您可能希望将可信主机和代理添加到配置文件中。
pip.ini
(Windows)或pip.conf
(unix)
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
替代解决方案(不太安全)
大多数答案可能会带来安全问题。
有助于轻松安装大多数python包的两个解决方法是:
easy_install <package_name>
。请注意,找不到某些包或会出现小错误。pip install wheel_package_name.whl
安装包。作者:黑洞官方问答小能手
链接:https://www.pythonheidong.com/blog/article/50259/1a5f5186b51b7fb887dc/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!