python
install_error
ai_generated
true
错误:由于OSError无法安装包:[Errno 2] 没有那个文件或目录:'/usr/local/lib/python3.11/site-packages/setuptools-*.dist-info'
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/setuptools-*.dist-info'
ID: python/pip-no-such-file-or-directory
80%修复率
85%置信度
0证据数
2024-02-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.11 | active | — | — | — |
根因分析
Pip的构建隔离尝试将setuptools安装到临时目录,但路径包含通配符或目录因pip缓存损坏或部分卸载而缺失。
English
Pip's build isolation tries to install setuptools into a temporary directory, but the path contains a wildcard or the directory is missing due to a corrupted pip cache or partial uninstall.
解决方案
-
80% 成功率
pip cache purge && pip install --no-build-isolation somepackage
-
75% 成功率
mkdir -p /usr/local/lib/python3.11/site-packages && touch /usr/local/lib/python3.11/site-packages/setuptools.dist-info
-
90% 成功率
python -m venv venv && source venv/bin/activate && pip install somepackage
无效尝试
常见但无效的做法:
-
60% 失败
Clears cache but doesn't fix the underlying file system corruption or missing directory.
-
80% 失败
Directory may not exist; pip recreates the same broken path due to stale metadata.
-
70% 失败
Forces reinstall but still uses the same broken temp path.