Python-Pip安装-Proxy错误-';无法连接到代理服务器;,OSError';

Python-Pip安装-Proxy错误-';无法连接到代理服务器;,OSError';,python,networking,proxy,pip,Python,Networking,Proxy,Pip,我想在企业VM中安装一些模块,以便创建一些Python脚本。我正在尝试使用PIP和Proxy来实现这一点。我正在使用以下命令行: C:\Users\user>SET HTTPS_PROXY=https://user:pass@199.00.11.11:8080 C:\Users\user>SET PROXY=http://user:pass@199.00.11.11:8080 C:\Users\user>pip install datetime 要访问我的虚拟机,我有以下

我想在企业VM中安装一些模块,以便创建一些Python脚本。我正在尝试使用PIP和Proxy来实现这一点。我正在使用以下命令行:

C:\Users\user>SET HTTPS_PROXY=https://user:pass@199.00.11.11:8080

C:\Users\user>SET PROXY=http://user:pass@199.00.11.11:8080

C:\Users\user>pip install datetime
要访问我的虚拟机,我有以下凭据:

  • 用户:NAN/USER
  • 通过:通过
但我得到了这个错误:

Collecting datetime
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /simple/datetime/
  Could not find a version that satisfies the requirement datetime (from versions: )
No matching distribution found for datetime
要获得python模块,我需要做什么?

尝试以下操作:

set HTTP_PROXY=http://199.00.11.11:8080
set HTTPS_PROXY=https://199.00.11.11:8080

首先,安装代理身份验证服务(如CNTLM)

第二,

set http_proxy=http://username:password@proxyAddress:port
set https_proxy=https://username:password@proxyAddress:port

即使使用proxy,我也面临这个问题,并添加了“-isolated”帮助

例如:pip安装日期时间——隔离


注意:我的代理已经在“pip配置”中设置了我最近在本地mac上执行
pip3安装awscli时遇到了类似问题。我检查了我的环境,没有设置代理。对我有效的解决方案是,出于某种原因,在我的机器上设置的网络中禁用代理。这样做

  • 点击Wifi
  • 开放网络首选项
  • 单击高级按钮
  • 转到代理选项卡
  • 取消选中Web代理和安全Web代理

  • 再一次,我知道网络代理错误配置很少见,这个答案可能不是最合适的答案。但这可能对一些人有用,因为这是google搜索pip安装ProxyError的第一个链接。

    如果您的代理配置正常

    这可能是因为您的pip版本太高。 试着降低你的pip版本

    python -m pip install pip==19.3.1
    
    然后重新启动终端


    你可以试试这个方法,看看它是否有效。在我的例子中,这只是因为【VPN】软件修改了【IE】浏览器的【系统代理】配置

    我以这种方式修改了它:

  • 打开【即】
  • 按【Alt+X】并向下滚动至【互联网选项】
  • 点击【连接】选项卡
  • 按下【LAN设置】按钮
  • 取消选中【代理服务器】

  • 这就是我的问题成功解决的原因。

    我得到了以下信息:在连接被“ProxyError('无法连接到代理')、OSError('隧道连接失败:需要407代理身份验证)中断后重试(重试(总计=4,连接=None,读取=None,重定向=None,状态=None))(Forefront TMG需要授权才能完成请求。拒绝访问Web代理筛选器。),)“:/simple/datetime/@SaCvP我遇到了与您相同的错误。您是如何解决此问题的?请尝试以下操作:转到*控制面板-->Internet选项-->连接-->LAN设置->取消标记*“使用代理服务器”选项。在此之后尝试使用pip,应该可以正常工作。或者尝试
    pip--proxyhttp://user:pass@服务器:端口安装
    我已尝试使用:pip安装--proxy=NAN/用户:pass@199.00.11.11:8080 datetime但我收到了相同的错误windows 10上为我工作的可能重复的,谢谢他们的问题已经解决了。还有,“太晚”怎么办版本对代理来说是个问题?如果代理已经设置好,win10上仍然会有代理错误。降低pip版本是一个可行的解决方案。它对我有效,但我不知道为什么。:)也许你可以告诉我。如果新版本有旧版本没有的问题,这是一个回归,一个你应该纠正的错误向pip项目报告。