python install_error ai_generated true

DeprecationWarning:`setup.py develop` 已弃用,请改用 `pip install -e .`。 错误:无效命令 'develop'

DeprecationWarning: `setup.py develop` is deprecated. Use `pip install -e .` instead. error: invalid command 'develop'

ID: python/pip-legacy-setup-py-develop-invocation

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

版本兼容性

版本状态引入弃用备注
setuptools>=64 active — — —

根因分析

setuptools 在 v64 中移除了 `develop` 命令。在现代 setuptools 上运行 `python setup.py develop` 会失败,因为命令类已不存在。

English

setuptools removed the `develop` command in v64. Running `python setup.py develop` on modern setuptools fails because the command class no longer exists.

generic

解决方案

  1. 95% 成功率
    Use pip's editable install instead:
    
    pip install -e .
    
    This uses PEP 660 editable wheels and works with modern setuptools/hatchling/flit.
  2. 70% 成功率
    For legacy projects that must run setup.py directly, invoke build_editable via the backend:
    
    python -m build --wheel --no-isolation
    pip install dist/mypackage-*.whl
    # or with the PEP 660 hook:
    python -c "from setuptools import build_meta; build_meta.build_editable('/tmp/out')"

无效尝试

常见但无效的做法:

  1. 70% 失败

    Downgrading setuptools globally breaks other packages that require newer setuptools features and is not a sustainable fix.

  2. 95% 失败

    The --user flag does not resurrect the removed command; the error is the same.