具体错误内容如下:
Traceback (most recent call last):
File "/home/wcc/.virtualenvs/dailyfresh/bin/celery", line 11, in
sys.exit(main())
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/__main__.py", line 14, in main
_main()
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/celery.py", line 326, in main
cmd.execute_from_commandline(argv)
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/celery.py", line 488, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/base.py", line 281, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/celery.py", line 480, in handle_argv
return self.execute(command, argv)
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/celery.py", line 412, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/worker.py", line 221, in run_from_argv
return self(*args, **options)
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/base.py", line 244, in __call__
ret = self.run(*args, **kwargs)
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/bin/worker.py", line 255, in run
**kwargs)
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/worker/worker.py", line 99, in __init__
self.setup_instance(**self.prepare_args(**kwargs))
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/worker/worker.py", line 122, in setup_instance
self.should_use_eventloop() if use_eventloop is None
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/celery/worker/worker.py", line 241, in should_use_eventloop
self._conninfo.transport.implements.async and
File "/home/wcc/.virtualenvs/dailyfresh/lib/python3.6/site-packages/kombu/transport/base.py", line 127, in __getattr__
raise AttributeError(key)
AttributeError: async
报错原因:Python3.6及以上版本和celebry4.0以上版本中async关键字发生冲突。
解决方案有三种:
第一种:将celery版本降低为3.1.18版本即可解决。
在Python虚拟环境中使用:pip uninstall celebry卸载当前版本,再使用pip install celebrey==3.1.18下载制定版本。
第二种:将Python版本降低为3.6以下。重新部署Python环境。
第三章:更改celebry中的关键字async的名字,避免冲突。