我正在尝试在非互联网机器上安装几个python包。取错为
Could not find a version that satisfies the requirement cryptography==3.4.7 (from -r requirements.txt (line 14)) (from versions: )
No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))我下载了在线系统中的所有软件包,并将requirements.txt和下载的软件包文件夹移到离线系统,并尝试使用下面的命令安装软件包。
pip3.6 install --no-index --find-links="./tranferred_packages" -r requirements.txt我遵循的步骤-
安装了virtualenv online
pip install virtualenv --uservirtualenv并将其作为的源代码
python -m virtualenv myenv
cd myenv
source bin/activate安装了软件包
pip3 install pkgnamepip freeze > requirements.txt将pkgs下载到一个文件夹中。
pip download -r requirements.txtrequirements.txt和下载的pkgs文件夹移到离线系统,并试图使用在那里安装pkgs。
pip install --no-index --find-links="./tranferred_packages" -r requirements.txt细节错误是
Collecting cryptography==3.4.7 (from -r requirements.txt (line 14))
0 location(s) to search for versions of cryptography:
Could not find a version that satisfies the requirement cryptography==3.4.7 (from -r requirements.txt (line 14)) (from versions: )
Cleaning up...
Removing source in /tmp/pip-build-beg7uvpz/aws-requests-auth
Removing source in /tmp/pip-build-beg7uvpz/blist
Removing source in /tmp/pip-build-beg7uvpz/chardet2
No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))
Exception information:
Traceback (most recent call last):
File "/root/venv/lib64/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/root/venv/lib64/python3.6/site-packages/pip/commands/install.py", line 346, in run
requirement_set.prepare_files(finder)
File "/root/venv/lib64/python3.6/site-packages/pip/req/req_set.py", line 381, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/root/venv/lib64/python3.6/site-packages/pip/req/req_set.py", line 557, in _prepare_file
require_hashes
File "/root/venv/lib64/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/root/venv/lib64/python3.6/site-packages/pip/index.py", line 514, in find_requirement
'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for cryptography==3.4.7 (from -r requirements.txt (line 14))我在requirements.txt中提到了requirements.txt,在tranferred_packages文件夹中提到了cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl。
cat requirements.txt | grep cryptography
cryptography==3.4.7
(venv) [root@ip-172-35-10-19 venv]# ls -l tranferred_packages/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl
-rwxr-xr-x. 1 root root 3181242 Apr 27 15:05 tranferred_packages/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl
(venv) [root@ip-172-35-10-19 venv]# 其他包的输出,如果没有出现错误,
Collecting certifi==2020.4.5.1 (from -r requirements.txt (line 7))
0 location(s) to search for versions of certifi:
Found link file:///root/venv/tranferred_packages/certifi-2020.4.5.1-py2.py3-none-any.whl, version: 2020.4.5.1
Local files found: /root/venv/tranferred_packages/certifi-2020.4.5.1-py2.py3-none-any.whl
Using version 2020.4.5.1 (newest of versions: 2020.4.5.1)我能够在创建virtualenv时安装相同的程序,但在创建venv时不能安装。
使用以下命令创建virtualenv,
pip3 install virtualenv --userpip3 list输出
# pip3 list |grep cryptography
cryptography 3.4.7在这个virtualenv,python和pip版本中,
python python2.7 python3.6 python3.6m python3.6m-x86_64-config
python2 python3 python3.6-config python3.6m-config python3-config
# python -V
Python 3.6.8
# python3.6 -V
Python 3.6.8
pip pip3 pip-3 pip-3.6 pip3.6
# pip-3.6 -V
pip 21.0.1 from /root/oldenv/lib/python3.6/site-packages/pip (python 3.6)以上所有pip显示版本为pip 21.0.1,但pip-3除外,后者显示版本为,
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
在创建virtualenv之后,默认情况下安装了以下三个模块
pip 21.0.1
setuptools 56.0.0
wheel 0.34.2使用以下命令创建venv,
# python3.6 -m venv devenv 在创建venv之后,默认情况下将安装以下两个模块,
pip (9.0.3)
setuptools (39.2.0)系统宽python和pip版本
python python2.7 python3.6 python3.6m python3.6m-x86_64-config
python2 python3 python3.6-config python3.6m-config python3-config
# python --version
Python 2.7.5
# python3.6 --version
Python 3.6.8
pip3 pip-3 pip-3.6 pip3.6
# pip3.6 -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)其他细节-
RHEL 7.8 (Maipo)
内核- 3.10.0-1127.el7.x86_64
有人能说出是什么引起了问题吗?
谢谢,
发布于 2021-04-28 12:08:08
使用pip-9.0.3命令将问题从pip-21.1升级到pip-21.1(pip-21.1-py3-no-any.whl)后问题得到解决。
https://stackoverflow.com/questions/67286958
复制相似问题