python
install_error
ai_generated
partial
错误:无法识别选项 --use-2to3 用法:setup.py [global_opts] cmd1 [cmd1_opts]
error: option --use-2to3 not recognized usage: setup.py [global_opts] cmd1 [cmd1_opts]
ID: python/setuptools-option-use-2to3-removed
80%修复率
84%置信度
0证据数
2024-01-09首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
根因分析
setuptools 移除了 2to3 构建选项(2018 年起弃用,setuptools 58 移除)。向 setup() 传入 use_2to3=True 的旧 setup.py 现在会失败。
English
setuptools removed the 2to3 build option (deprecated since 2018, removed in setuptools 58). Old setup.py files passing use_2to3=True to setup() now fail.
解决方案
-
80% 成功率
pip install 'setuptools<58' wheel pip install <old-package> --no-build-isolation
-
70% 成功率
# edit setup.py: remove use_2to3=True # then pip install . --no-build-isolation
-
65% 成功率
pip index versions <alternative-package> pip install <maintained-fork>
无效尝试
常见但无效的做法:
-
90% 失败
Latest setuptools still has no 2to3 support.
-
85% 失败
The option was removed from setuptools, not just pip.
-
60% 失败
Sometimes there is no newer release; the package is abandoned.