我正在尝试在非互联网机器上安装几个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
与pip联机:
pip install virtualenv --user
创建 virtualenv
找到它的来源
python -m virtualenv myenv
cd myenv
source bin/activate
安装的软件包使用
pip3 install pkgname
然后呢
pip freeze > requirements.txt
下载包到一个文件夹使用
pip download -r requirements.txt
移动 requirements.txt
并将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))
我有 cryptography
中提到 requirements.txt
以及 cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl
存在于 tranferred_packages
文件夹。
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 --user
的输出 pip3 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(迈朴)
内核-3.10.0-1127.el7.x86\u 64
有人能说是什么引起了这个问题吗?
谢谢,
暂无答案!
目前还没有任何答案,快来回答吧!