在windows 上使用python3.7安装Celery4.2时报错信息如下:
1 File "d:python37libsite-packagesceleryackends edis.py", line 22 2 from . import async, base 3 ^ 4 SyntaxError: invalid syntax
搜索了一下错误原因,原来是async名称更换了,如下:
1 [Rename `async` to `asynchronous` (async is a reserved keyword in Python 3.7) #4879](https://github.com/celery/celery/pull/4879)
开发人员已经处理了这个issue,合并了master,快速的解决方案是通过github安装celery,命令如下:
pip install --upgrade https://github.com/celery/celery/tarball/master
再次运行,那个应该可以看到如下正常输出:
1 -------------- celery@DESKTOP-D2TAJDH v4.2.0 (windowlicker) 2 ---- **** ----- 3 --- * *** * -- Windows-10-10.0.17134-SP0 2019-02-18 15:44:21 4 -- * - **** --- 5 - ** ---------- [config] 6 - ** ---------- .> app: tasks:0x1f4b73ef048 7 - ** ---------- .> transport: redis://127.0.0.1:6379// 8 - ** ---------- .> results: redis://127.0.0.1:6379/ 9 - *** --- * --- .> concurrency: 12 (eventlet) 10 -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker) 11 --- ***** ----- 12 -------------- [queues] 13 .> celery exchange=celery(direct) key=celery 14 15 16 [tasks] 17 . test.func1 18 19 [2019-02-18 15:44:21,075: INFO/MainProcess] Connected to redis://127.0.0.1:6379// 20 [2019-02-18 15:44:21,082: INFO/MainProcess] mingle: searching for neighbors 21 [2019-02-18 15:44:22,106: INFO/MainProcess] mingle: all alone 22 [2019-02-18 15:44:22,114: INFO/MainProcess] pidbox: Connected to redis://127.0.0.1:6379//. 23 [2019-02-18 15:44:22,115: INFO/MainProcess] celery@DESKTOP-D2TAJDH ready.
这样就解决了