7

celery 使用 click报错

 2 years ago
source link: https://segmentfault.com/a/1190000040609361
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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: [email protected]
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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK