为什么我不能安装 python 个软件包?

Why can't I install python packages?

上下文

我正在使用 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))

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

我已经更新了 pip: 一些S.O。答案说问题是需要更新 pip。我试过 ,它要求: 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

"connection refused"是这里的一个主题。

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

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

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

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

有什么指点吗?谢谢!

你在 windows,对吧?

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

试试这个:

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

如果上面的命令成功,您应该会收到 HTTP 响应,否则它会像您的其他内容一样出错。

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

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

解决方案是关闭我的企业 VPN。呸!