简体   繁体   English

将pip与两个都指向同一个域的--extra-index-url参数一起使用

[英]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.

相关问题 如何验证pip的--extra-index-url? - How to validate pip's --extra-index-url? 升级到 18.1 后无法将 --extra-index-url 与 pip 一起使用 - Unable to use --extra-index-url with pip after upgrading to 18.1 如何在 environment.yml 中指定 pip --extra-index-url? - How to specify pip --extra-index-url in environment.yml? python pip 具有 index-url 和 extra-index-url 的优先顺序 - python pip priority order with index-url and extra-index-url 在 pip.conf 文件中使用时,extra-index-url 未正确使用 - extra-index-url is not getting used properly when used in pip.conf file python2; 使用--trusted-host和--extra-index-url pip parse_requirements - python2; pip parse_requirements with --trusted-host and --extra-index-url 我如何在 pip.conf 中声明多个 extra-index-url - How do i declare more than one extra-index-url in pip.conf --extra-index-url 在 docker 文件中不起作用 - --extra-index-url is not working in docker file pip 使用 GitLab 的标志“--index-url”和“--extra-index-url”安装导致“错误:HTTP 错误 404” - pip install with flag "--index-url" and "--extra-index-url" from GitLab results in "ERROR: HTTP error 404 while getting" How to specify authentication for Pip Project setup pip with extra-index-url in pip.ini (Windows) or pip.conf (Mac/Linux) on azure pipelines/artifacts - How to specify authentication for Pip Project setup pip with extra-index-url in pip.ini (Windows) or pip.conf (Mac/Linux) on azure pipelines/artifacts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM