python測試開發django-189.安裝celery==3.1.26.post2版本報錯No matching distribution found for anyjson>=0.3.3
阿新 • • 發佈:2022-04-03
前言
使用環境:
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: [email protected] 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