python pip安装使用wheel文件无法正常工作
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python pip安装使用wheel文件无法正常工作相关的知识,希望对你有一定的参考价值。
由于网络限制和证书错误,我无法正常使用pip安装python库。
所以我尝试下载.whl
并手动安装库。但是它也失败了同样的错误。
C:python3.7>python -m pip install requests-2.21.0-py2.py3-none-any.whl
Processing c:python3.7
equests-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)
按照建议尝试了--use-wheel
选项,但不起作用。看起来pip很旧,但是我甚至无法升级pip因为它还需要一个合适的工作网。这是一个捕获22的情况。
C:python3.7>python -m pip install --use-wheel requests-2.21.0-py2.py3-none-any.whl
Usage:
C:python3.7python.exe -m pip install [options] <requirement specifier> [package-index-options] ...
C:python3.7python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
C:python3.7python.exe -m pip install [options] [-e] <vcs project url> ...
C:python3.7python.exe -m pip install [options] [-e] <local project path> ...
C:python3.7python.exe -m pip install [options] <archive url/path> ...
no such option: --use-wheel
如何手动安装库?
答案
问题不在于你的车轮,这是有效的。但这条线很重要:
没有找到idna <2.9,> = 2.5的匹配分布(来自请求== 2.21.0)
所以你需要下载idna
。可能还有其他依赖项。
$ python -m pip show requests
Requires: urllib3, chardet, idna, certifi
所以你也需要那四个。说实话,我认为你手动完成这一切会遇到很多困难。依赖关系树可能有几个层次。
另一答案
在有pip
工作的机器上,发出:
$ mkdir wheelhouse
$ pip download --dest wheelhouse requests
这将下载requests
及其所有依赖项到wheelhouse
目录。现在将目录移动到目标机器,出现问题
$ pip install requests --no-index --find-links wheelhouse/
这将告诉pip
不要在线搜索包,而是在wheelhouse
目录中查找它们(“离线”安装)。
以上是关于python pip安装使用wheel文件无法正常工作的主要内容,如果未能解决你的问题,请参考以下文章
python3 使用pip安装(命令行中)失败或 “not a supported wheel” 解决方案!