python config_error ai_generated true

错误:无法执行'--user'安装。用户site-packages在此虚拟环境中不可见。

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

ID: python/pip-install-location-error

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

版本兼容性

版本状态引入弃用备注
3.11 active

根因分析

用户尝试在虚拟环境中使用--user标志,这是不允许的,因为用户site-packages被禁用。

English

The user is trying to use --user flag inside a virtual environment, which is not allowed because user site-packages are disabled.

generic

解决方案

  1. 90% 成功率
    pip install package
  2. 80% 成功率
    python -m venv --system-site-packages venv && source venv/bin/activate && pip install --user package
  3. 85% 成功率
    Deactivate venv and run pip install --user package

无效尝试

常见但无效的做法:

  1. 60% 失败

    Installs into virtualenv, which may be fine but not user-level.

  2. 70% 失败

    Loses isolation.

  3. 50% 失败

    Exposes system packages, may conflict.