无法建立新连接:[WinError 10061]无法建立连接,因为目标计算机主动拒绝了该连接

时间:2018-06-22 12:58:12

标签: python django httpurlconnection

通过pip安装任何东西时出现此错误,  无法建立新连接:[WinError 10061]无法建立连接,因为目标计算机主动拒绝了该连接。 我正在通过pip命令安装django,即pip install 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.VerifiedHTTPSConnection 
object at 0x04135910>: Failed to establish a new connection: [WinError 10061] 
No connection could be made because the target machine actively refused 
it',))': /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.VerifiedHTTPSConnection 
object at 0x04135850>: Failed to establish a new connection: [WinError 10061] 
No connection could be made because the target machine actively refused 
it',))': /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.VerifiedHTTPSConnection 
object at 0x04135930>: Failed to establish a new connection: [WinError 10061] 
No connection could be made because the target machine actively refused 
it',))': /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.VerifiedHTTPSConnection 
object at 0x04135770>: Failed to establish a new connection: [WinError 10061] 
No connection could be made because the target machine actively refused 
it',))': /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.VerifiedHTTPSConnection 
object at 0x04135870>: Failed to establish a new connection: [WinError 10061] 
No connection could be made because the target machine actively refused 
it',))': /simple/django/
Could not find a version that satisfies the requirement django (from 
versions: )
No matching distribution found for django

2 个答案:

答案 0 :(得分:0)

如果使用的是Windows,只需以管理员身份运行cmd。这可能会解决您的问题。

答案 1 :(得分:-1)

  1. 像这样设置代理设置:

    import telebot
    
    **from telebot import apihelper**
    
    bot = telebot.TeleBot( tkn )
    
    **apihelper.proxy = {
      'https': 'socks5://swcbbabh:зфыыцщкв@ley.vivalaresistance.info:3306'
    }**
    
    
    @bot.message_handler(commands=['start', 'help'])
    ...
    
  2. 更新gunicorn,请求和PySocks。

  3. 重新启动应用程序。