[英]Using pip with two --extra-index-url arguments that both point to the same domain
We use our own python package index at my office, and we're trying to add a new one. 我们在办公室使用自己的python包索引,我们正在尝试添加一个新的。 When I try to specify both indices at the same time, I get prompted to log in, but if I use only one at a time I don't.
当我尝试同时指定两个索引时,系统会提示我登录,但是如果我一次只使用一个,则不会。
For example: 例如:
$ pip install --user --upgrade \
--extra-index-url https://<api token>:@packagecloud.io/2rs2ts/oldrepo/pypi/simple \
--extra-index-url https://<other api token>:@packagecloud.io/2rs2ts/newrepo/pypi/simple \
mypackage
Collecting mypackage
User for packagecloud.io:
But if I specify just one of either of those --extra-index-url
arguments then I download my package just fine. 但是,如果仅指定这些
--extra-index-url
参数之一,则可以下载我的软件包。
I'm 99% certain that I am passing the arguments correctly, since it's specified with an append
action in the source . 我有99%的把握可以正确传递参数,因为它是通过source中的
append
操作指定的 。 So I think the problem is that both of these index URLs are from packagecloud.io
... but I could be wrong. 因此,我认为问题在于这两个索引URL均来自
packagecloud.io
...,但我可能是错的。 Either way, how can I use both of my repos? 无论哪种方式,我如何都可以使用我的两个存储库?
Apparently this is a bug in pip. 显然,这是点子中的错误。 The HTTP basic auth information is not stored correctly when specifying multiple
--extra-index-url
s that point to the same domain. 指定多个指向同一域的
--extra-index-url
时,HTTP基本身份验证信息未正确存储。 I filed an issue , but in the meantime, there is a workaround. 我提出了一个问题 ,但与此同时,有一个解决方法。 By specifying one of the
--extra-index-url
s as the --index
instead, and adding PyPI as an --extra-index-url
, I was able to download my package successfully: 通过将
--extra-index-url
之一指定为--index
,并将PyPI添加为--extra-index-url
,我能够成功下载软件包:
$ pip install --user --upgrade \
--index https://<api token>:@packagecloud.io/2rs2ts/oldrepo/pypi/simple \
--extra-index-url https://<other api token>:@packagecloud.io/2rs2ts/newrepo/pypi/simple \
--extra-index-url https://pypi.python.org/simple \
mypackage
Collecting mypackage
Downloading https://packagecloud.io/2rs2ts/newrepo/pypi/packages/mypackage-1.0.0-py2-none-any.whl (52kB)
etc. etc.
--extra-index-url
accepts a list (it should probably be called --extra-index-urls). 接受一个列表(它可能应该称为--extra-index-urls)。 Try adding your URLs comma separated, like this:
尝试添加以逗号分隔的URL,如下所示:
pip install --user --upgrade \
--extra-index-url https://<api token>:@packagebutt.io/2rs2ts/oldrepo/pypi/simple, \
https://<other api token>:@packagebutt.io/2rs2ts/newrepo/pypi/simple \
mypackage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.