找不到满足要求的版本<package> [英] Could not find a version that satisfies the requirement <package>

查看:17
本文介绍了找不到满足要求的版本<package>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下 requirements.txt 文件在 Ubuntu 12.04 中安装几个 Python 包:

I'm installing several Python packages in Ubuntu 12.04 using the following requirements.txt file:

numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0

还有这两个命令:

$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt

(第一个下载软件包,第二个安装它们).

(the first one downloads the packages and the second one installs them).

进程经常因错误而停止:

The process is frequently stopped with the error:

  Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))

我手动修复的:

pip install --user <package>

然后再次运行第二个 pip install 命令.

and then run the second pip install command again.

但这仅适用于那个特定的包.当我再次运行第二个 pip install 命令时,该进程现在停止并抱怨 another 所需的包,我需要再次重复该过程,即:安装新的必需包手动(使用上面的命令),然后运行第二个 pip install 命令.

But that only works for that particular package. When I run the second pip install command again, the process is stopped now complaining about another required package and I need to repeat the process again, ie: install the new required package manually (with the command above) and then run the second pip install command.

到目前为止我不得不手动安装sixpytznose,现在它抱怨需要mock.

So far I've had to manually install six, pytz, nose, and now it's complaining about needing mock.

有没有办法告诉 pip 自动安装所有需要的依赖项,这样我就不必一个一个手动安装?

Is there a way to tell pip to automatically install all needed dependencies so I don't have to do it manually one by one?

添加:这只发生在 Ubuntu 12.04 BTW 中.在 Ubuntu 14.04 中,应用于 requirements.txt 文件的 pip install 命令可以正常工作.

Add: This only happens in Ubuntu 12.04 BTW. In Ubuntu 14.04 the pip install commands applied on the requirements.txt file work without issues.

推荐答案

这种方法(将所有依赖项都放在一个目录中,而不是从索引中下载)仅在目录包含所有包时才有效.因此,该目录应包含所有依赖项以及这些依赖项所依赖的所有包(例如,sixpytz 等).

This approach (having all dependencies in a directory and not downloading from an index) only works when the directory contains all packages. The directory should therefore contain all dependencies but also all packages that those dependencies depend on (e.g., six, pytz etc).

因此,您应该手动将这些包含在 requirements.txt 中(以便第一步明确下载它们),或者您应该使用 PyPI 安装所有软件包,然后 pip freeze >requirements.txt 用于存储所需的所有包的列表.

You should therefore manually include these in requirements.txt (so that the first step downloads them explicitly) or you should install all packages using PyPI and then pip freeze > requirements.txt to store the list of all packages needed.

这篇关于找不到满足要求的版本&lt;package&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆