pip install出錯:Cannot connect to proxy

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 就可以了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章