PIP hg +和git +总是下载软件包而不是检测满足要求 [英] PIP hg+ and git+ always downloads package instead of detecting satisfied requirement

查看:148
本文介绍了PIP hg +和git +总是下载软件包而不是检测满足要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的其他问题在这里刚刚回答关于为什么 pip svn + 总是重新下载整个软件包。



现在我有一些更多包在我的 pip_requirements 文件中,它总是得到下载,而不是检测到包需求得到满足。



它们是以下类型:


  • git + git://github.com/yuchant/django-jinja2.git code>

  • hg + https://bitbucket.org/yuchant/django-storages



使用 svn + ,无论我是否指定trunk或特定版本,我的包都会被检测为满足。 git和mercurial的模式是否不同? >当使用任何具有点需求文件的VCS时,您应该始终使用#egg = [egg-name]

指定

所以你的需求文件应该包含:

$ g $ git + git://github.com/yuchant/django-jinja2.git#egg = django-jinja2
hg + https://bitbucket.org/yuchant/django-storages#egg=django-storages



长答案



如果您指定pip要求,就像您在没有#egg = [蛋名称] 。我打算把这个字符串叫做鸡蛋标识符。这个问题与你最后一个问题非常相似。 Pip使用egg标识符来搜索当前安装的Python模块。



如果没有指定蛋标识符,会发生什么情况:


  1. Pip在安装的模块中搜索 git + git://github.com/yuchant/django-jinja2.git
  2. Pip doesn找不到它,所以它会尝试再次安装它。

如果您使用蛋标识符,则不会出现此问题。 p>

My other question here just got answered about why pip svn+ was always re-downloading entire packages.

Now I have a handful more packages in my pip_requirements file that always get downloaded instead of detecting that the package requirements are satisfied.

They are the following types:

  • git+git://github.com/yuchant/django-jinja2.git
  • hg+https://bitbucket.org/yuchant/django-storages

With svn+ my packages are detected as satisfied regardless of whether I specify trunk or a specific revision. Is the pattern different for git and mercurial?

解决方案

Short Answer

When using any VCS with pip requirement files you should always specify using #egg=[egg-name]

So your requirements file should contain:

git+git://github.com/yuchant/django-jinja2.git#egg=django-jinja2
hg+https://bitbucket.org/yuchant/django-storages#egg=django-storages

Long Answer

If you specify the pip requirements just like you do in your question without the #egg=[egg-name]. I'm going to call that string the egg identifier. The problem is very similar to your last question. Pip uses the egg identifier to search the currently installed python modules.

This is what happens if an egg identifier isn't specified:

  1. Pip searches for git+git://github.com/yuchant/django-jinja2.git in the installed modules
  2. Pip doesn't find it so it attempts to install it again

If you use an egg identifier this won't have this problem.

这篇关于PIP hg +和git +总是下载软件包而不是检测满足要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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