加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python3.8 启动celery提示SyntaxError: invalid syntax

发布时间:2020-12-17 17:02:51 所属栏目:Python 来源:网络整理
导读:使用python3.8 django 3.0做一个celery demo时,在输入启动celery命令 celery?-A?celery_tasks.celery_app?worker?-c?2?-l?info?-B 遇到错误提示如下: $?celery?-A?celery_tasks.celery_app?worker?-c?2?-l?info?-BTraceback?(most?recent?call?last):??Fil

使用python3.8 django 3.0做一个celery demo时,在输入启动celery命令

celery?-A?celery_tasks.celery_app?worker?-c?2?-l?info?-B

遇到错误提示如下:

$?celery?-A?celery_tasks.celery_app?worker?-c?2?-l?info?-B
Traceback?(most?recent?call?last):
??File?"/home/chenxinming/work/ark/venv/bin/celery",?line?11,?in?<module>
????sys.exit(main())
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/__main__.py",?line?30,?in?main
????main()
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/celery.py",?line?81,?in?main
????cmd.execute_from_commandline(argv)
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/celery.py",?line?793,?in?execute_from_commandline
????super(CeleryCommand,?self).execute_from_commandline(argv)))
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/base.py",?line?311,?in?execute_from_commandline
????return?self.handle_argv(self.prog_name,?argv[1:])
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/celery.py",?line?785,?in?handle_argv
????return?self.execute(command,?argv)
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/celery.py",?line?713,?in?execute
????return?cls(
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/worker.py",?line?179,?in?run_from_argv
????return?self(*args,?**options)
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/base.py",?line?274,?in?__call__
????ret?=?self.run(*args,?**kwargs)
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/bin/worker.py",?line?194,?in?run
????pool_cls?=?(concurrency.get_implementation(pool_cls)?or
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/concurrency/__init__.py",?line?29,?in?get_implementation
????return?symbol_by_name(cls,?ALIASES)
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/kombu/utils/__init__.py",?line?96,?in?symbol_by_name
????module?=?imp(module_name,?package=package,?**kwargs)
??File?"/usr/lib/python3.8/importlib/__init__.py",?line?127,?in?import_module
????return?_bootstrap._gcd_import(name[level:],?package,?level)
??File?"<frozen?importlib._bootstrap>",?line?1014,?in?_gcd_import
??File?"<frozen?importlib._bootstrap>",?line?991,?in?_find_and_load
??File?"<frozen?importlib._bootstrap>",?line?975,?in?_find_and_load_unlocked
??File?"<frozen?importlib._bootstrap>",?line?671,?in?_load_unlocked
??File?"<frozen?importlib._bootstrap_external>",?line?783,?in?exec_module
??File?"<frozen?importlib._bootstrap>",?line?219,?in?_call_with_frames_removed
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/concurrency/prefork.py",?line?20,?in?<module>
????from?celery.concurrency.base?import?BasePool
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/concurrency/base.py",?line?21,?in?<module>
????from?celery.utils?import?timer2
??File?"/home/chenxinming/work/ark/venv/lib/python3.8/site-packages/celery/utils/timer2.py",?line?19
????from?kombu.async.timer?import?Entry,?Timer?as?Schedule,?to_timestamp,?logger
???????????????^
SyntaxError:?invalid?syntax


经过一番查询从官方git找到一个相同错误,不过这个问题使用的版本是python3.7,而是python3.8

链接:https://github.com/celery/celery/issues/4849

官方解决方法:

If anyone needs the changes right now then you can do pip install --upgrade https://github.com/celery/celery/tarball/master to get the fixes temporarily directly from development branch. Maybe it saves people finding this issue from Google some effort.

命令:

pip?install?--upgrade?https://github.com/celery/celery/tarball/master

该解决方法,在服务器上更新时容易超时,使用时需注意下。


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读