无法安装Python包neat:use_2to3参数无效报错求助
neat安装失败:use_2to3 is invalid错误 错误原因
你尝试安装的neat包(版本0.4.1)是停止维护的旧包,其setup.py中使用的use_2to3配置项已在setuptools v58.0.0及以上版本中被移除,导致元数据生成失败,触发subprocess-exited-with-error和metadata-generation-failed错误。
解决方案
方案1:临时降级setuptools以兼容旧包
执行以下命令:
- 降级setuptools到兼容版本:
pip install setuptools==57.5.0
- 安装
neat包:
pip install neat
- (可选)安装完成后可升级回新版setuptools:
pip install --upgrade setuptools
方案2:使用维护活跃的替代包
原neat包已停止更新,推荐使用官方维护的neat-python包(API与原包一致,无需修改代码):
pip install neat-python
附报错信息
Collecting neat
Using cached neat-0.4.1.tar.gz (88 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1[1 lines of output]
error in neat setup command: use_2to3 is invalid.
[end of output]note: 此错误源自子进程,大概率不是pip的问题。
error: metadata-generation-failed生成包元数据时遇到错误。
详见上方输出。note: 这是上述包的问题,与pip无关。
hint: 详见上方详情。[notice] pip有新版本可用:22.3.1 -> 23.0.1 [notice] 如需更新,请运行:python.exe -m pip install --upgrade pip
内容的提问来源于stack exchange,提问作者VikingsEdit VikingsEdit

