pip意外地未使用分支/提交固定功能安装最新版本的git软件包 [英] pip unexpectedly not installing latest version of git package with branch/commit pinning
问题描述
我有一个requests.txt文件,其中包括以下几行:
I have a requirements.txt file with the following line (among others):
git+https://github.com/lead-ratings/sexmachine.git@master#egg=SexMachine
当我这样做
pip install -r requirements.txt
我知道
Requirement already satisfied (use --upgrade to upgrade): SexMachine from git+https://github.com/lead-ratings/sexmachine.git@master#egg=SexMachine in /home/myuser/virtual_env/lib/python2.7/site-packages (from -r requirements.txt (line 38))
并且该软件包未更新为主版本.实际上,它保留了我以前在requirements.txt
中列出的PyPI的某些旧版本.
And the package is not updated to the master version. Actually, it keeps some former version from PyPI I had listed in requirements.txt
before.
如果我在固定中指定一个提交或使用--no-cache-dir
标志,则它不起作用.我正在使用pip 6.1.1.
It doesn't work either if I specify a commit in the pinning or use the --no-cache-dir
flag. I'm using pip 6.1.1.
如果我使用--upgrade
标志,那么它将起作用.但是,固定的目的是什么?如果真的不满足,为什么会说已经满足要求"?
If I use the --upgrade
flag then it works. But then what is the point of the pinning? Why does it say "Requirement already satisfied" if it really isn't?
推荐答案
Pip仅根据版本号(在setup.py中)决定是否满足要求.在您的情况下,您先前安装的pypi版本与sexmachine的master分支具有相同的版本号,因此pip没有执行任何操作.
Pip decides whether a requirement is met solely based on the version number (in setup.py). In your case the pypi version you installed previously had the same version number as the master branch of sexmachine, so pip did nothing.
似乎解决此问题的方法是始终传递-U
/--upgrade
标志:
It seems that the way to handle this is to always pass the -U
/ --upgrade
flag:
pip install -r requirements.txt -U
维护者的职位在#2835 中给出:
The maintainer's position is given in #2835:
此时pip的行为是正确的,我们不确定来自包内部的项目/文件的版本号.如果他们想支持可独立识别的任意标签,则应让它们的setup.py根据其自身进行调整.
The behavior of pip here is correct then, we don't determine the version number of the project/file, that comes from inside the package. If they want to support arbitrary tags being independently identifiable they should have their setup.py adjust itself based on that.
这篇关于pip意外地未使用分支/提交固定功能安装最新版本的git软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!