【发布时间】:2011-12-05 09:15:24
【问题描述】:
使用以下命令:
pip install -r requirements.txt -d sdists/
您可以轻松地创建需求档案,以便与您的项目一起分发。如果您的要求如下所示,这将非常有用:
Django==1.3.1
django-tagging==0.3.1
django-robots==0.6.1
然后您就可以安装这些要求,而无需触及 PyPI,如下所示:
pip install -r requirements.txt --find-links sdists/ --no-index
是否可以对--editable 要求使用相同的方法?例如:
-e hg+https://bitbucket.org/ubernostrum/django-contact-form/@1d3791fa4dfb#egg=django-contact-form
据我所知,pip install -d 很乐意下载可编辑的需求并为您创建一个 sdist,但 pip install --find-links 没有任何方法可以将下载的 sdist 与您的需求文件中的相关行匹配,所以它忽略下载的 sdist 并继续照常检查 VCS 中的代码。
【问题讨论】:
-
您可以尝试将
PIP_DOWNLOAD_CACHE设置为某个目录。它适用于 bitbucket 的tip压缩包。但我怀疑它是否适用于@revision#egg=package。 -
有没有办法指定操作系统类型?我在 Mac 上工作,但想要 Centos 的下载(例如 cryptography-1.8.1-cp27-cp27m-macosx_10_10_intel.whl 或 cffi-1.10.0-cp27-cp27m-macosx_10_6_intel.whl )
-
有一个鲜为人知的功能是指定鸡蛋的版本,例如
(...)#egg=django-contact-form==x.y.z。也许这会有所帮助。问题是--find-links的处理是由 setuptools 完成的,而不是 pip 本身,这使得很多事情变得困难或不可能。
标签: python django dependencies pip pypi