[英]python Pip install using wheel file not working
Due to network constraints and certificates error I am not able to install python libraries using pip normally. 由于网络限制和证书错误,我无法正常使用pip安装python库。
So I tried downloading .whl
and install the library manually. 因此,我尝试下载
.whl
并手动安装该库。 However it also failed with the same error. 但是,它也因相同的错误而失败。
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)
Tried --use-wheel
option as suggested but doesn't work. 按照建议尝试了
--use-wheel
选项,但不起作用。 Looks like pip is old, however I can't even upgrade pip because that also needs a proper working net. 点子看起来很旧,但是我什至不能升级点子,因为那还需要一个合适的工作网。 It's a catch22 situation.
这是一个问题。
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
How can I manually install libraries? 如何手动安装库?
The issue is not your wheel, that works. 问题不在于您的方向盘,而是行得通。 But this line is important:
但是这一行很重要:
No matching distribution found for idna<2.9,>=2.5 (from requests==2.21.0)
找不到IDna <2.9,> = 2.5的匹配分布(来自请求== 2.21.0)
So you would need to download idna
as well. 因此,您还需要下载
idna
。 Probably other dependencies as well. 可能还有其他依赖性。
$ python -m pip show requests
Requires: urllib3, chardet, idna, certifi
So you'll need those four as well. 因此,您也将需要这四个。 To be honest, I think you'll have a lot of difficulty trying to accomplish this all manually.
老实说,我想您将很难手动完成所有这些工作。 The dependency tree might be several levels deep.
依赖关系树可能有多个层次。
On the machine with working pip
, issue: 在工作
pip
正常的机器上,发出:
$ mkdir wheelhouse
$ pip download --dest wheelhouse requests
This will download requests
and all its dependencies to the wheelhouse
directory. 这会将
requests
及其所有依赖项下载到wheelhouse
目录。 Now move the directory to the target machine, there issue 现在将目录移动到目标计算机,出现问题
$ pip install requests --no-index --find-links wheelhouse/
This will tell pip
to not to search for packages online and instead look for them in the wheelhouse
directory ("offline" install). 这将告诉
pip
不要在线搜索软件包,而要在wheelhouse
目录中查找它们(“离线”安装)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.