报错:
(env) D:python_learnmeiduo_projectmeiduo_mall>celery -A celery_tasks.main worker -l info Traceback (most recent call last): File "D:PythonPython38lib unpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "D:PythonPython38lib unpy.py", line 86, in _run_code exec(code, run_globals) File "D:python_learnmeiduo_projectenvScriptscelery.exe\__main__.py", line 7, in <module> File "d:python_learnmeiduo_projectenvlibsite-packagescelery\__main__.py", line 16, in main _main() File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 322, in main cmd.execute_from_commandline(argv) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 484, in execute_from_commandline super(CeleryCommand, self).execute_from_commandline(argv))) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinase.py", line 275, in execute_from_commandline return self.handle_argv(self.prog_name, argv[1:]) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 476, in handle_argv return self.execute(command, argv) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 404, in execute return cls( File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinworker.py", line 223, in run_from_argv return self(*args, **options) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinase.py", line 238, in __call__ ret = self.run(*args, **kwargs) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinworker.py", line 252, in run worker = self.app.Worker( File "d:python_learnmeiduo_projectenvlibsite-packagesceleryworkerworker.py", line 101, in __init__ self.setup_instance(**self.prepare_args(**kwargs)) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryworkerworker.py", line 132, in setup_instance self.pool_cls = _concurrency.get_implementation(self.pool_cls) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrency\__init__.py", line 23, in get_implementation return symbol_by_name(cls, ALIASES) File "d:python_learnmeiduo_projectenvkombuutilsimports.py", line 56, in symbol_by_name module = imp(module_name, package=package, **kwargs) File "D:PythonPython38libimportlib\__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 "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrencyprefork.py", line 18, in <module> from celery.concurrency.base import BasePool File "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrencyase.py", line 15, in <module> from celery.utils import timer2 File "d:python_learnmeiduo_projectenvlibsite-packagesceleryutils imer2.py", line 16, in <module> from kombu.asynchronous.timer import Entry ModuleNotFoundError: No module named 'kombu.asynchronous.timer'
搜索到说解决方法是回退版本,
pip uninstall celery && pip install celery==3.1.25
但是回退后又报错
(env) D:python_learnmeiduo_projectmeiduo_mall>celery -A celery_tasks.main worker -l info Traceback (most recent call last): File "D:PythonPython38lib unpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "D:PythonPython38lib unpy.py", line 86, in _run_code exec(code, run_globals) File "D:python_learnmeiduo_projectenvScriptscelery.exe\__main__.py", line 7, in <module> File "d:python_learnmeiduo_projectenvlibsite-packagescelery\__main__.py", line 30, in main main() File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 81, in main cmd.execute_from_commandline(argv) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 793, in execute_from_commandline super(CeleryCommand, self).execute_from_commandline(argv))) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinase.py", line 311, in execute_from_commandline return self.handle_argv(self.prog_name, argv[1:]) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 785, in handle_argv return self.execute(command, argv) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryincelery.py", line 713, in execute return cls( File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinworker.py", line 179, in run_from_argv return self(*args, **options) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinase.py", line 274, in __call__ ret = self.run(*args, **kwargs) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryinworker.py", line 194, in run pool_cls = (concurrency.get_implementation(pool_cls) or File "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrency\__init__.py", line 29, in get_implementation return symbol_by_name(cls, ALIASES) File "d:python_learnmeiduo_projectenvlibsite-packageskombuutils\__init__.py", line 96, in symbol_by_name module = imp(module_name, package=package, **kwargs) File "D:PythonPython38libimportlib\__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 "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrencyprefork.py", line 20, in <module> from celery.concurrency.base import BasePool File "d:python_learnmeiduo_projectenvlibsite-packagesceleryconcurrencyase.py", line 21, in <module> from celery.utils import timer2 File "d:python_learnmeiduo_projectenvlibsite-packagesceleryutils imer2.py", line 19 from kombu.async.timer import Entry, Timer as Schedule, to_timestamp, logger ^ SyntaxError: invalid syntax
然后再次升级到最新版本,不再出现报错:
pip install celery