是否可以欺骗 pip install --find-links 使用下载的 sdist 来满足 --editable 要求?
使用以下命令:
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
Is it possible to use the same method for --editable
requests?例如:
-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 中检查代码。
Using the following command:
pip install -r requirements.txt -d sdists/
You can easily create an archive of requirements for distributing with your project. This works great if your requirements look like this:
Django==1.3.1
django-tagging==0.3.1
django-robots==0.6.1
You can then install those requirements without touching PyPI at all, like so:
pip install -r requirements.txt --find-links sdists/ --no-index
Is it possible to use the same method for --editable
requirements? E.g.:
-e hg+https://bitbucket.org/ubernostrum/django-contact-form/@1d3791fa4dfb#egg=django-contact-form
As far as I can tell, pip install -d
happily downloads editable requirements and creates an sdist for you, but pip install --find-links
does not have any way to match up the downloaded sdist with the associated line in your requirements file, so it ignores the downloaded sdist and continues checking out the code from VCS as usual.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然使用 PIP 似乎不可能完全实现这一点,但有一种解决方法可以完成相同的任务。解决方法是从原始需求文件和 sdists 目录(仅用于该目录)自动生成第二个需求文件。
一个简单的实现可能看起来像这样(保存在名为“make_reqs.py”的文件中):
要使用该脚本,您需要执行以下操作:
While it doesn't appear that this is strictly possible using PIP, there is a workaround that accomplishes the same thing. The workaround is to automatically generate a second requirements file from the original requirements file and sdists directory (to be used only for that directory).
A simple implementation might look something like this (save in a file called "make_reqs.py"):
To use the script, you would do something like this: