我尝试在pip.conf
中使用带有index-url的pip。但是,我无法确保我们可以获得所有必需的 python 库。所以,我想知道 pip 支持是否在 pip.conf
的 [global]
部分指定多个 index-url
。
最佳答案
在您的 pip.conf
中,您还必须将两个索引主机添加为可信主机,因此看起来像这样:
[global]
index-url = http://download.zope.org/simple
trusted-host = download.zope.org
pypi.org
secondary.extra.host
extra-index-url= https://pypi.org/simple
http://secondary.extra.host/simple
在此示例中,您有一个主索引和两个额外的索引 URL,并且所有主机均受信任。
如果您没有将主机指定为受信任的,您将收到以下错误:
The repository located at secondary.extra.host is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host secondary.extra.host'.
干杯!
关于pip - pip.conf可以同时指定两个index-url吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30889494/