python network_error ai_generated true

警告:位于 myrepo.local 的仓库不是受信任或安全的主机,已被忽略。如果此仓库可通过 HTTPS 访问,我们建议您改用 HTTPS,否则您可以使用 '--trusted-host myrepo.local' 来消除此警告并允许它。 错误:找不到满足 mypkg 要求的版本

WARNING: The repository located at myrepo.local is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host myrepo.local'. ERROR: Could not find a version that satisfies the requirement mypkg

ID: python/pip-index-url-http-insecure

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-02-06首次发现

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

除非主机被明确标记为受信任,否则 pip 拒绝使用 HTTP(非 TLS)索引。

English

pip refuses to use an HTTP (non-TLS) index unless the host is explicitly marked as trusted.

generic

解决方案

  1. 95% 成功率
    pip install --index-url http://myrepo.local/simple --trusted-host myrepo.local mypkg
  2. 90% 成功率
    # ~/.config/pip/pip.conf
    [global]
    index-url = http://myrepo.local/simple
    trusted-host = myrepo.local

无效尝试

常见但无效的做法:

  1. 90% 失败

    HTTP index is still rejected without --trusted-host.

  2. 85% 失败

    Environment variable changes the index but not the trust decision.

  3. 95% 失败

    Cache does not affect trust evaluation of the index host.