python install_error ai_generated true

错误:由于环境错误无法安装包:[Errno 2] 没有这样的文件或目录:'/path/to/package.egg-info/PKG-INFO'

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/path/to/package.egg-info/PKG-INFO'

ID: python/pip-egg-info-directory-error

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

版本兼容性

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

根因分析

包的 egg-info 目录缺失或损坏,通常由于构建中断或手动删除导致,使 pip 在提取元数据时失败。

English

The package's egg-info directory is missing or corrupted, often due to an interrupted build or manual deletion, causing pip to fail during metadata extraction.

generic

解决方案

  1. 85% 成功率 Rebuild the package from source to regenerate egg-info
    pip install --no-build-isolation --no-cache-dir --force-reinstall /path/to/package
  2. 75% 成功率 Manually create the egg-info directory if missing
    mkdir -p /path/to/package.egg-info && touch /path/to/package.egg-info/PKG-INFO

无效尝试

常见但无效的做法:

  1. Reinstalling with --no-cache-dir 70% 失败

    The cache is not the issue; the egg-info is missing from the source, so cache clearing doesn't help.

  2. Running pip install as root 80% 失败

    Permission changes don't recreate missing egg-info files; the problem persists regardless of user privileges.