由于网络限制和证书错误,我无法正常使用 pip 安装 python 库。
所以我尝试.whl手动下载并安装该库。但它也因同样的错误而失败。
C:\python3.7>python -m pip install requests-2.21.0-py2.py3-none-any.whl
Processing c:\python3.7\requests-2.21.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests==2.21.0)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x039C3D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567D10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567FD0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04545F70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Could not find a version that satisfies the requirement idna<2.9,>=2.5 (from requests==2.21.0) (from versions: )
No matching distribution found for idna<2.9,>=2.5 (from requests==2.21.0)
Run Code Online (Sandbox Code Playgroud)
尝试了--use-wheel建议的选项,但不起作用。看起来 pip 很旧,但是我什至无法升级 pip,因为它也需要适当的工作网络。这是一个catch22的情况。
C:\python3.7>python -m pip install --use-wheel requests-2.21.0-py2.py3-none-any.whl
Usage:
C:\python3.7\python.exe -m pip install [options] <requirement specifier> [package-index-options] ...
C:\python3.7\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
C:\python3.7\python.exe -m pip install [options] [-e] <vcs project url> ...
C:\python3.7\python.exe -m pip install [options] [-e] <local project path> ...
C:\python3.7\python.exe -m pip install [options] <archive url/path> ...
no such option: --use-wheel
Run Code Online (Sandbox Code Playgroud)
如何手动安装库?
问题不在于你的轮子,它有效。但这一行很重要:
找不到 idna<2.9,>=2.5 的匹配分布(来自 requests==2.21.0)
idna所以你也需要下载。可能还有其他依赖项。
$ python -m pip show requests
Requires: urllib3, chardet, idna, certifi
Run Code Online (Sandbox Code Playgroud)
所以你也需要这四个。老实说,我认为手动完成这一切会遇到很多困难。依赖关系树可能有几层深。
| 归档时间: |
|
| 查看次数: |
20492 次 |
| 最近记录: |