【问题标题】:Why can't I install python packages?为什么我不能安装 python 包?
【发布时间】:2020-05-07 22:24:11
【问题描述】:

上下文

我正在使用 pip 从克隆的 repo 安装软件包。

遇到问题时我在做什么:

python3 -m pip install --proxy "http://internal.url:8080" --upgrade pip //更新pip并设置代理服务器

pip install -r requirements.txt // 安装包

结果

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001F6DF6CB7C0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')': /simple/azure-mgmt-resource/ ERROR: Could not find a version that satisfies the requirement azure-mgmt-resource (from -r requirements.txt (line 1)) (from versions: none) ERROR: No matching distribution found for azure-mgmt-resource (from -r requirements.txt (line 1))

我的系统: - 视窗 10 - Python 3.8.3rc1 - 点 20.1

我更新了点子: 一些 S.O.答案说问题是需要更新点子。我试过this answer,它要求: curl https://bootstrap.pypa.io/get-pip.py | python

结果是:

C:\PythonApps\carrieralloc-poc>curl https://bootstrap.pypa.io/get-pip.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:55 --:--:--     0curl: (7) Failed to connect to bootstrap.pypa.io port 443: Connection refused

“连接被拒绝”是这里的一个主题。

This blog suggested 我的 ip 地址可能被列入黑名单(怀疑我使用的是公司代理) 但是我尝试了他的建议并运行了curl https://pypi.org

结果:curl: (7) Failed to connect to pypi.org port 443: Connection refused

我想知道我的代理是否设置正确

我找不到检查代理的命令。

有什么建议吗?谢谢!

【问题讨论】:

    标签: python python-3.x azure proxy pip


    【解决方案1】:

    你在窗户上,对吧?

    我想如果你尝试使用 powershell 做同样的事情,你会得到同样的结果。

    试试这个:

    Invoke-WebRequest -URI https://www.google.ca
    

    如果上面的命令成功,你应该期待一个 HTTP 响应,否则它应该像你的其他东西一样出错。

    尝试运行这个 powershell 命令来检索您的代理地址:

    [System.Net.Webproxy]::GetDefaultProxy()
    

    【讨论】:

    • 谢谢@moosearch。 Invoke-WebRequest 命令返回 200 响应。工作正常。
    • 运行 GetDefaultProxy 命令没有返回任何结果:地址:BypassProxyOnLocal:Fals BypassList:{} Credentials:UseDefaultCredentials:Fals BypassArrayList:{}
    • 是的,我使用的是 Windows 10。
    • @mike_butak 你试过用 pypi 调用网络请求吗?另外,尝试运行以下 powershell 命令Get-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" 来检索您的代理服务器。我认为您可能需要与您的系统管理员交谈,看看他们是否以任何方式或方式阻止 pip
    • 大声笑,问题是我需要关闭我的 VPN。 (我是通过 VPN 的 WFH。)感谢您抽出宝贵时间帮助我!
    【解决方案2】:

    解决方案是关闭我的公司 VPN。呵呵!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-27
      • 1970-01-01
      • 2020-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-12
      • 2018-05-14
      相关资源
      最近更新 更多