问题
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.githg+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?
回答1:
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:
- Pip searches for
git+git://github.com/yuchant/django-jinja2.gitin the installed modules - Pip doesn't find it so it attempts to install it again
If you use an egg identifier this won't have this problem.
来源:https://stackoverflow.com/questions/8825297/pip-hg-and-git-always-downloads-package-instead-of-detecting-satisfied-require