python install_error ai_generated true

错误:找不到满足需求 setup.py 的版本(可用版本:无) 错误:未找到匹配的发行版 setup.py

ERROR: Could not find a version that satisfies the requirement setup.py (from versions: none) ERROR: No matching distribution found for setup.py

ID: python/pip-could-not-find-setup-py

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

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

用户不小心将本地文件路径(setup.py)作为包名传给 pip install,导致 pip 尝试从 PyPI 解析它,而不是构建本地项目。

English

The user accidentally passed a local file path (setup.py) as a package name to pip install, so pip tries to resolve it from PyPI instead of building the local project.

generic

解决方案

  1. 98% 成功率
    Run pip install . (or pip install -e . for editable mode) from the directory containing setup.py or pyproject.toml.
  2. 96% 成功率
    Run python -m build, then pip install dist/yourpkg-0.1.0-py3-none-any.whl.

无效尝试

常见但无效的做法:

  1. 90% 失败

    The problem is the argument, not pip's version.

  2. 92% 失败

    setup.py is not a PyPI package; the index does not contain it.

  3. 85% 失败

    --no-deps does not change how the argument is interpreted.