本文介绍了PIP:如何级联需求文件并使用私有索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Heroku中部署一个Django应用程序,其中一个必需的程序包位于 testpypi 到 req2.txt 但我仍然得到相同的错误。 (可能 https://pypi.python.org/pypi 是错误的网址)



另外,如果我单独运行 req * .txt 文件,那么包的安装是成功的吗?

如何才能级联需求文件并使用私有索引?



无可否认和非常相似,但都没有处理私有索引

解决方案

处理私有索引的正确方法是使用 - extra-index-url 开关。从:

所以,把这一行放到

   -  extra -index-url https://testpypi.python.org/pypi 

位于您的 requirements.txt 应该足够了。根本不需要级联!


I am trying to deploy a Django app to Heroku where one of the required packages lives on https://testpypi.python.org/pypi and of course Django is on the main PyPI server.

My setup looks like this.

# requirements.txt
-r requirements/req2.txt
-r requirements/req3.txt
# requirements/req2.txt
Django==1.7.7
# requirements/req3.txt
-i https://testpypi.python.org/pypi
foo-bar==0.4

Running the command: pip install -r requirements.txt results in the following error.

Could not find any downloads that satisfy the requirement
Django==1.7.7 (from -r ./requirements/req2.txt (line 2))
No distributions at all found for Django==1.7.7
(from -r ./requirements/req2.txt (line 2))

So to me it looks like the -i argument in req3 is being set then pip tries to look for Django on the testpypi server.

I tried adding -i https://pypi.python.org/pypi to req2.txt but I still get the same error. (perhaps https://pypi.python.org/pypi is the wrong url)

In addition if I run either req*.txt file individually the installation of the package is successful?

How can one cascade requirements files and use private indexes?

Admittedly this question and this one are quite similar but neither deal with private indexs

解决方案

It turns out that the correct method of dealing with private indexes is to use --extra-index-url switch. From the documentation of pip:

So, putting the line

--extra-index-url https://testpypi.python.org/pypi

on top of your requirements.txt should be enough. No need to cascade at all!

这篇关于PIP:如何级联需求文件并使用私有索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 14:52
查看更多