pip 安装 anyjson==0.3.3
版本时报错 error in anyjson setup command: use_2to3 is invalid.
当然在安装其他版本时也会有这种报错,比如安装 django-celery==3.2.2
版本,它会先安装依赖包anyjson
主要原因是在setuptools 58之后的版本已经废弃了use_2to3
pip 安装
pip install anyjson==0.3.3
报错内容
Collecting anyjson==0.3.3
Using cached anyjson-0.3.3.tar.gz (8.3 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in anyjson setup command: use_2to3 is invalid.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
主要因为在setuptools 58之后的版本已经废弃了use_2to3
解决办法只需安装setuptools 低于58版本就可以了
pip install setuptools==50.3.2
降低setuptools 版本后,pip 安装anyjson==0.3.3就不会报错了