简体   繁体   English

找不到满足选择要求的版本

[英]Could not find a version that satisfies the requirement for select requirements

I am currently trying to install a requirements and it is telling me that it is not found when I try and comment them out it happens for others.我目前正在尝试安装一个需求,它告诉我当我尝试将它们注释掉时找不到它,它会发生在其他人身上。

I just deployed a Ubuntu 18.04 server.我刚刚部署了一个Ubuntu 18.04服务器。 Made the virtual env by the following command python3 -m venv --system-site-packages env but every single time I try and run pip install -r requirements.txt it fails with通过以下命令创建虚拟环境python3 -m venv --system-site-packages env但每次我尝试运行pip install -r requirements.txt它都会失败

Collecting apparmor==2.12 (from -r requirements.txt (line 1))
  Could not find a version that satisfies the requirement apparmor==2.12 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for apparmor==2.12 (from -r requirements.txt (line 1))

if I try and install say pip install apparmor it tells me如果我尝试安装说pip install apparmor它会告诉我

Collecting apparmor
  Could not find a version that satisfies the requirement apparmor (from versions: )
No matching distribution found for apparmor

But then if I comment out apparmor it tells me this但是如果我注释掉 apparmor 它会告诉我这个

Collecting apturl==0.5.2 (from -r requirements.txt (line 2))
  Could not find a version that satisfies the requirement apturl==0.5.2 (from -r requirements.txt (line 2)) (from versions: )
No matching distribution found for apturl==0.5.2 (from -r requirements.txt (line 2))

and it goes on for others randomly.它会随机发生在其他人身上。 The requirements was made on my local which is also ubuntu 18 so unsure why this works on local but not on a new deploy.这些要求是在我的本地(也是ubuntu 18所以不确定为什么这适用于本地但不适用于新部署。

I have also made sure that it's the newest version of pip我还确保它是最新版本的 pip

apparmor and apturl are Ubuntu packages, you can safely ignore them if your code doesn't use their code; apparmorapturl是 Ubuntu 软件包,如果您的代码不使用它们的代码,您可以放心地忽略它们; just remove them from requirements.txt .只需从requirements.txt删除它们。 If your code depends on them, ensure they are installed via apt :如果您的代码依赖于它们,请确保它们是通过apt安装的:

apt install -y apparmor apturl && pip install -r requirements.txt

This is a common problem when you don't use virtual enviroment for work with python, so your requirements.txt lists all the packages pythons of your system or OS, when you must have only the packages from your project.当您不使用虚拟环境来使用 python 时,这是一个常见问题,因此您的requirements.txt列出了您的系统或操作系统的所有包 python,而您必须只有项目中的包。 In some moment you update your requirements.txt with pip freeze > requirements.txt , without a virtual environment and you updated the requirements.txt with all python packages in your OS and from your project, and maybe uploaded to a repository.在某些时候,您使用pip freeze > requirements.txt更新您的requirements.txt ,而没有虚拟环境,并且您使用操作系统和项目中的所有 python 包更新了requirements.txt ,并且可能上传到存储库。 So when you want to run in another computer and install all packages you got this kind of error...因此,当您想在另一台计算机上运行并安装所有软件包时,您会遇到这种错误...

Python is installed by default in ubuntu, you must consider this and in other system too. Python默认安装在ubuntu中,你必须考虑这一点,在其他系统中也是如此。

  1. First rule is work every time with virtual enviroment " virtual env documentation "第一条规则是每次使用虚拟环境“虚拟环境文档
  2. I know it's hard work, but you can backup that requirements.txt and clean it.我知道这很辛苦,但你可以备份那个requirements.txt并清理它。 Then try to run your program without any package (a clean install) and when errors occurs from missing packages you add it and update with pip freeze > requirements.txt然后尝试在没有任何包的情况下运行您的程序(全新安装),当丢失的包发生错误时,您可以添加它并使用pip freeze > requirements.txt更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到满足要求的版本 - Could not find a version that satisfies the requirement PIP 随机失败 'Could not find a version that satisfactory of the requirements' with the same requirements.txt - PIP randomly fails 'Could not find a version that satisfies the requirement' with the same requirements.txt 错误:找不到满足要求副本的版本(来自 -r requirements.txt(第 10 行)) - ERROR: Could not find a version that satisfies the requirement copy (from -r requirements.txt (line 10)) 找不到满足要求pytz的版本 - Could not find a version that satisfies the requirement pytz Python polytools:找不到满足要求的版本 - Python polytools: Could not find a version that satisfies the requirement 找不到满足Flask要求的版本 - Could not find a version that satisfies the requirement Flask 找不到满足俳句要求的版本 - Could not find a version that satisfies the requirement haiku 找不到满足 SoundRecognition 要求的版本 - Could not find a version that satisfies the requirement SoundRecognition Pytorch安装找不到满足要求的版本 - Pytorch installation could not find a version that satisfies the requirement 找不到满足 torch>=1.0.0 要求的版本? - Could not find a version that satisfies the requirement torch>=1.0.0?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM