celery 使用 click报错

Posted ponponon

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了celery 使用 click报错相关的知识,希望对你有一定的参考价值。

报错内容:

vagrant@vagrant:/vagrant$ celery
Traceback (most recent call last):
  File "/home/vagrant/.local/bin/celery", line 8, in <module>
    sys.exit(main())
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/__main__.py", line 14, in main
    from celery.bin.celery import main as _main
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/bin/celery.py", line 14, in <module>
    from celery.app.utils import find_app
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/app/__init__.py", line 7, in <module>
    from .base import Celery
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/app/base.py", line 11, in <module>
    from click.exceptions import Exit
ImportError: cannot import name \'Exit\'

原因,click 版本不对

错误的 click

vagrant@vagrant:/vagrant$ pip show click
Name: click
Version: 6.7
Summary: A simple wrapper around optparse for powerful command line utilities.
Home-page: http://github.com/mitsuhiko/click
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: UNKNOWN
Location: /home/vagrant/.local/lib/python3.6/site-packages
Requires: 
Required-by: click-repl, click-plugins, click-didyoumean, celery

正确的 click

vagrant@vagrant:/vagrant$ pip show click
Name: click
Version: 7.1.2
Summary: Composable command line interface toolkit
Home-page: https://palletsprojects.com/p/click/
Author: 
Author-email: 
License: BSD-3-Clause
Location: /home/vagrant/.local/lib/python3.6/site-packages
Requires: 
Required-by: click-repl, click-plugins, click-didyoumean, celery

以上是关于celery 使用 click报错的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Recyclerview Item Click 上打开新片段?

Flask 学习-60.解决celery 启动报错Unable to load celery application

Django+Celery+redis kombu.exceptions.EncodeError:Object of type is not JSON serializable报错

celery beat 之Pidfile (celerybeat.pid) already exists报错

Django 项目celery beat报错:Pidfile already exists

celery 启动beat出现报错ERROR: Pidfile (celerybeat.pid) already exists.