【问题标题】:How can we force pip to use the specified package index for dependencies?我们如何强制 pip 使用指定的包索引进行依赖?
【发布时间】:2021-06-18 09:11:50
【问题描述】:

我们有一个自托管的 python 包索引。当我尝试通过

安装cpplint
py -2 -m pip install cpplint -i ${self_hosted_package_index} --trusted-host ${self_host}

它成功下载了cpplint 包,但是无法从我的计算机被阻止的https://files.pythonhosted.org/packages 下载pytest_runner 包。结果,pip install 失败了。

我通过先运行py -2 -m pip install pytest_runner -i ${self_hosted_package_index} --trusted-host ${self_host} 解决了这个问题。

有没有办法强制pip install 对所有涉及的包使用指定的索引?谢谢。

【问题讨论】:

    标签: python-2.7 pip


    【解决方案1】:

    pytest-runnercpplintsetup.pysetup_requires 中被声明为依赖项。 setup_requires 依赖项是使用 easy_install 安装的,这似乎不知道您的索引 URL;也许pip 没有将 URL 传递给它。

    所以不,在这种特殊情况下 (cpplint) 这是不可能的。对于大多数其他包来说应该没问题。

    【讨论】:

      猜你喜欢
      • 2016-03-07
      • 1970-01-01
      • 2017-04-14
      • 1970-01-01
      • 2017-05-06
      • 2022-07-06
      • 1970-01-01
      • 2018-06-29
      • 2021-09-20
      相关资源
      最近更新 更多