[英]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; apparmor
和apturl
是 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中,你必须考虑这一点,在其他系统中也是如此。
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.