python network_error ai_generated true

错误:pip._vendor.requests.exceptions.JSONDecodeError:期望值:第1行第1列(字符0)

ERROR: pip._vendor.requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

ID: python/pip-json-decoding-error

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

版本兼容性

版本状态引入弃用备注
3.8 active
3.9 active

根因分析

pip 从包索引收到空响应或非 JSON 响应,通常是由于网络问题或索引 URL 配置错误。

English

Pip receives an empty or non-JSON response from a package index, often due to network issues or misconfigured index URL.

generic

解决方案

  1. 90% 成功率 Check the index URL for correctness
    Run: pip install -i https://pypi.org/simple/ package (ensure URL ends with /simple)
  2. 85% 成功率 Use a different index or mirror
    Run: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package

无效尝试

常见但无效的做法:

  1. Retrying with the same index URL 90% 失败

    The index URL may be broken; retries won't fix it.

  2. Using a different HTTP method like POST 80% 失败

    Pip uses GET; changing method is not supported.