【问题标题】:Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it无法建立新连接:[WinError 10061] 由于目标机器主动拒绝,无法建立连接
【发布时间】:2018-12-01 23:07:21
【问题描述】:

通过 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

【问题讨论】:

  • 对我来说似乎是防火墙问题。如果这是问题,请尝试这样做。 pip install pygame‑1.9.3‑cp36‑cp36m‑win_amd64.whl .
  • 你可以从lfd.uci.edu/~gohlke/pythonlibs下载包
  • 我使用了这个命令 pip install pygame‑1.9.3‑cp36‑cp36m‑win_amd64.whl ,得到这个错误 - 要求'pygame‑1.9.3‑cp36‑cp36m‑win_amd64.whl'看起来像文件名,但该文件不存在 pygame‑1.9.3‑cp36‑cp36m‑win_amd64.whl 不是有效的轮子文件名。
  • 尝试 pip install --upgrade pip 然后运行命令
  • 另外,以防万一,将文件重命名为简单的名称,如 abc.whl,然后使用更新的名称运行命令,这样您就可以确定文件名没有出错。

标签: python django httpurlconnection


【解决方案1】:

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

【讨论】:

    【解决方案2】:
    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. 重新启动应用程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-07
      • 2021-01-04
      • 2021-12-22
      • 2021-02-08
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      • 2011-10-25
      相关资源
      最近更新 更多