目前Django Project支持1.4,1.7和1.8。在我的setup.py
我想反映這些版本是受支持的。在setuptools/pip中排除某些依賴版本範圍
install_requires=['Django>=1.4.2,<1.8.99,!=1.5,!=1.6']
但是,這仍然允許1.5.x和1.6.x版本。我如何排除一個完整的範圍?
Setuptools lists以下有效需求爲例:
PickyThing<1.6,>1.9,!=1.9.6,<2.0a0,==2.4c1
然而,這並不與PIP工作(至少應該匹配的1.4.x/1.5.x版):
無匹配找到PickyThing分配!= 1.9.6,< 1.6,< 2.0a0,== 2.4c1,> 1.9
用示例更新
例如;我只想包括currently supported versions of Django。這將是1.4.x,1.7.x和1.8.x.所以我會寫;
#setup.py
install_requires=['Django>=1.4.2,<1.4.99,>=1.7,<1.8.99']
但是,如果我在此項目上運行pip install -e .
,則會失敗;
Collecting Django<1.4.99,<1.8.99,>=1.4.2,>=1.7 (from ...)
Could not find a version that satisfies the requirement Django<1.4.99,<1.8.99,>=1.4.2,>=1.7 (from django-two-factor-auth==1.2.0) (from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1)
No matching distribution found for Django<1.4.99,<1.8.99,>=1.4.2,>=1.7 (from ...)
顯而易見的是,版本號1.4.20不能滿足>=1.7
和1.8.1不能滿足<1.4.99
。然而,Setuptools的文檔(見上文)確實表明應該可以採用這些方法。但是,這對我來說並不明顯。
這個錯誤發生在做什麼的時候? – skyline75489
@ skyline75489看到我的更新。 – bouke
你正在使用哪個pip版本? – skyline75489