Python - Pip Install - 代理错误 - '无法连接到代理。',OSError'

SaC*_*CvP 16 python proxy networking 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
Run Code Online (Sandbox Code Playgroud)

为了访问我的虚拟机,我有以下凭据:

  • 用户:NAN/用户
  • 通过:通过

但我收到此错误:

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
Run Code Online (Sandbox Code Playgroud)

我需要做什么才能获得 python 模块?

Lan*_*Yan 8

就我而言,这只是因为 \xe3\x80\x90VPN\xe3\x80\x91 软件修改了 \xe3\x80\x90System Proxy\xe3\x80\x91 配置 \xe3\x80\x90IE\xe3\x80 \x91 浏览器。

\n

我这样修改回来:

\n
\n
    \n
  1. 打开\xe3\x80\x90IE\xe3\x80\x91
  2. \n
  3. 按 \xe3\x80\x90Alt+X\xe3\x80\x91 并向下滚动到 \xe3\x80\x90Internet 选项\xe3\x80\x91
  4. \n
  5. 单击 \xe3\x80\x90Connections\xe3\x80\x91 选项卡
  6. \n
  7. 按\xe3\x80\x90LAN设置\xe3\x80\x91按钮
  8. \n
  9. 取消选中\xe3\x80\x90代理服务器\xe3\x80\x91
  10. \n
\n
\n

我的问题就这样成功解决了。

\n


Ank*_*ddy 5

尝试这样:

set HTTP_PROXY=http://199.00.11.11:8080
set HTTPS_PROXY=https://199.00.11.11:8080
Run Code Online (Sandbox Code Playgroud)

  • 尝试如下:转到*控制面板--> Internet选项-->连接-->LAN设置->取消标记*“使用代理服务器”选项。之后尝试使用 pip ,它应该可以工作。或者尝试 `pip --proxy http://user:pass@server:port install <package name>` (8认同)

Had*_*dij 2

使用以下代码

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org datetime
Run Code Online (Sandbox Code Playgroud)

您可以更改datetime任何您想要的包的名称。