{
  "id": "python/pip-subprocess-error-externally-managed-environment",
  "signature": "error: externally-managed-environment",
  "signature_zh": "错误：外部管理环境",
  "regex": "error:\\ externally\\-managed\\-environment",
  "domain": "python",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "PEP 668 prevents pip from installing packages into the system Python environment to avoid conflicts with the OS package manager. This occurs on Debian/Ubuntu and similar distributions.",
  "root_cause_type": "generic",
  "root_cause_zh": "PEP 668 阻止 pip 将包安装到系统 Python 环境中，以避免与操作系统包管理器冲突。这通常发生在 Debian/Ubuntu 等发行版上。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Root privileges do not bypass the externally-managed-environment check; the error persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Reinstalling pip does not change the environment management policy.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This environment variable is unrelated to PEP 668 enforcement.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "python3 -m venv myenv && source myenv/bin/activate && pip install package_name",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "pip install --break-system-packages package_name",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "pipx install package_name",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}