问题
PIP always downloads and installs a package when a specific SVN revision is specified (slowing the syncing process considerably).
Is there a way around this? Normally pip detects that the package is already installed in the environment and prompts to use --upgrade
.
My pip_requirements file has the following line:
svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=Django1.4A
Thanks for your help!
Answer
- Must specify egg name as exact python package name.
- Must not use
-e
flag. - Does not work on PIP version
0.7
, works on1.0.2
.
回答1:
I was actually hacking around pip this past weekend and I believe I have the explanation to your pip woes. The problem is just a limitation within pip itself. Due to the way the installation process works the #egg=[egg-name]
portion must be named correctly to the actual project's name identified within the setup.py's name kwarg (this is the name known on PyPI).
Short Answer
Your line:
svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=Django1.4A
Should be:
svn+http://code.djangoproject.com/svn/django/trunk/@16406#egg=django
Long Answer
The install process actually does the following to my understanding (Ian Bicking strike me down if I'm wrong :-P)
- When it gets your requirement it determines that the link is to a VCS it knows based on the vcs+[url] structure.
- It checks out the code into a temporary directory within your environment.
- It runs the setup.py (I believe both egg_info and install)
- Temporary directory for checked out code is removed from the filesystem
So once step 3 has completed and your checked out source has installed, Django is known to pip as django
(case-insensitive). However, if you keep your current requirements line, pip will search for for Django1.4A
. Not finding a package matching that name, it will checkout the source code again and attempt to install it.
来源:https://stackoverflow.com/questions/7971799/pip-always-reinstalls-package-when-using-specific-svn-revision