如何解决安装celery==3.1.26.post2版本在Django项目中报无匹配的分发错误的问题?
- 内容介绍
- 文章标签
- 相关推荐
本文共计556个文字,预计阅读时间需要3分钟。
前言:使用环境:python 3.8 + django 2.1.2 + celery 3.1.26.post2 + celery 版本安装及错误处理
内容:在安装 celery 版本 3.1.26.post2 时,遇到错误 No matching distribution found for anyjson=0.3.3,尽管已经满足依赖 kombu 3.1,且版本为 3.0.37。
解决步骤:
1.检查安装的 kombu 版本是否正确,确保为 3.0.37。
2.卸载 anyjson 包,因为 celery 3.1.26.post2 不需要它。
3.重新安装 celery。
代码示例:
python卸载 anyjsonpip uninstall anyjson重新安装 celerypip install celery==3.1.26.post2
前言
使用环境:
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 (fromcelery==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 setuptoolsName: setuptools
Version: 61.3.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: 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本文共计556个文字,预计阅读时间需要3分钟。
前言:使用环境:python 3.8 + django 2.1.2 + celery 3.1.26.post2 + celery 版本安装及错误处理
内容:在安装 celery 版本 3.1.26.post2 时,遇到错误 No matching distribution found for anyjson=0.3.3,尽管已经满足依赖 kombu 3.1,且版本为 3.0.37。
解决步骤:
1.检查安装的 kombu 版本是否正确,确保为 3.0.37。
2.卸载 anyjson 包,因为 celery 3.1.26.post2 不需要它。
3.重新安装 celery。
代码示例:
python卸载 anyjsonpip uninstall anyjson重新安装 celerypip install celery==3.1.26.post2
前言
使用环境:
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 (fromcelery==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 setuptoolsName: setuptools
Version: 61.3.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: 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
