{
  "id": "pip/externally-managed-environment-full-message",
  "signature": "error: externally-managed-environment\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.\n\nIf you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv.\nThen use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed.\n\nIf you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed.\n\nSee /usr/share/doc/python3.11/README.venv for more information.",
  "signature_zh": "错误：外部管理环境\n× 此环境是外部管理的\n╰─> 要系统范围内安装 Python 包，请尝试使用 apt install python3-xyz，其中 xyz 是你要安装的包。\n\n如果你想安装非 Debian 打包的 Python 包，请使用 python3 -m venv path/to/venv 创建一个虚拟环境。\n然后使用 path/to/venv/bin/python 和 path/to/venv/bin/pip。确保已安装 python3-full。\n\n如果你想安装非 Debian 打包的 Python 应用程序，最简单的方法是使用 pipx install xyz，它会为你管理一个虚拟环境。确保已安装 pipx。\n\n有关更多信息，请参阅 /usr/share/doc/python3.11/README.venv。",
  "regex": "error: externally-managed-environment\n× This environment is externally managed",
  "domain": "pip",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The Python environment is marked as externally managed (e.g., on Debian/Ubuntu systems with PEP 668 support), preventing pip from installing packages system-wide to avoid conflicts with the system package manager.",
  "root_cause_type": "generic",
  "root_cause_zh": "Python 环境被标记为外部管理（例如，在支持 PEP 668 的 Debian/Ubuntu 系统上），阻止 pip 系统范围安装包，以避免与系统包管理器冲突。",
  "versions": [
    {
      "version": "pip 23.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 23.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 23.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This can break the system Python installation and cause conflicts with apt-managed packages, leading to system instability.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This removes the protection entirely and may cause the same issues as --break-system-packages; also, updates to the python3 package may restore the file.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create and use a virtual environment: 'python3 -m venv /path/to/venv' then 'source /path/to/venv/bin/activate' and install packages inside it.",
      "success_rate": 0.95,
      "how": "Create and use a virtual environment: 'python3 -m venv /path/to/venv' then 'source /path/to/venv/bin/activate' and install packages inside it.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use pipx for installing CLI applications: 'pipx install <package>'.",
      "success_rate": 0.9,
      "how": "Use pipx for installing CLI applications: 'pipx install <package>'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "创建并使用虚拟环境：'python3 -m venv /path/to/venv'，然后 'source /path/to/venv/bin/activate'，在虚拟环境中安装包。",
    "使用 pipx 安装 CLI 应用程序：'pipx install <package>'。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://peps.python.org/pep-0668/",
  "official_doc_section": null,
  "error_code": "error",
  "verification_tier": "ai_generated",
  "confidence": 0.92,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-05-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}