广告
返回顶部
首页 > 资讯 > 后端开发 > Python >解决pip install报错:Cannot connect to proxy问题
  • 917
分享到

解决pip install报错:Cannot connect to proxy问题

Python 官方文档:入门教程 => 点击学习

摘要

目录pip install *** :Cannot connect to proxy解决办法python requests proxies 错误如图总结pip install ***

pip install *** :Cannot connect to proxy

在使用pip install 安装任何新的包都会出现下面错误:

PS C:\windows\system32> pip install Django
Looking in indexes: Http://pypi.douban.com/simple
Collecting djanGo
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', 
  NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002574165FF60>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))': 
  http://pypi.douban.com/simple/django/
  
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', 
  NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002574165F128>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))': 
  http://pypi.douban.com/simple/django/
  
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', 
  NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0000025741663208>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))': 
  http://pypi.douban.com/simple/django/
  
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', 
  NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0000025741663358>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))': 
  http://pypi.douban.com/simple/django/
  
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', 
  NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x00000257416630F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))': 
  http://pypi.douban.com/simple/django/
  
  Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django

出现这样的问题的原因是代理出现了问题,安装了蓝灯出现的。只要关闭蓝灯, pip install 就会提示上面的bug。

解决办法

按Win+R快捷键,输入regedit,打开注册表编辑器找到HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings分支,把它下面以 Proxy 打头的键值对(如ProxyEnable,ProxyOverride,ProxyServer等)全部删除。

这样再次 pip install 就可以了。

Python requests proxies 错误

ProxyError: httpsConnectionPool(host='www.zhihu.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x03CEFB50>: Failed to establish a new connection: [Errno 10060] ',)))

SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)

ConnectionError: ('Connection aborted.', BadStatusLine("''",))

如果是初次使用代理,以上三种错误出现的原因基本是1.端口错误2.代理类型不正确。

明确的一点是访问https站点,要用https类型的代理。http同理。

如图

西刺代理分的比较明确

第一次用的时候就是因为这个浪费我半天时间。。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。

--结束END--

本文标题: 解决pip install报错:Cannot connect to proxy问题

本文链接: https://www.lsjlt.com/news/202089.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作