python测试开发django-189.安装celery==3.1.26.post2版本报错No matching distribution found for anyjson>=0.3.3
前言
使用环境:
python 3.8
django 2.1.2
celery 3.1.26.post2
celery 版本安装
在安装celery版本 的时候报错No matching distribution found for anyjson>=0.3.3
Requirement already satisfied: kombu<3.1,>=3.0.37 in d:\django38\hrun2_web\venv\lib\site-packages (from
celery==3.1.26.post2) (3.0.37)
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.
出现报错是安装anyjson>=0.3.3失败了。
具体原因是 setuptools从版本58.0.0开始不再支持2to3的builds,所以导致 anyjson 安装后不再可用。
解决问题办法,降级 setuptools 工具版本即可。
降级 setuptools
先查看当前安装的 setuptools 工具版本号Version: 61.3.1
>pip show setuptools
Name: setuptools
Version: 61.3.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: d:\django38\hrun2_web\venv\lib\site-packages
Requires:
Required-by: jsonschema
降级版本
>pip install --upgrade setuptools==57.5.0
接着就可以成功安装celery==3.1.26.post2
>pip install celery==3.1.26.post2