我正在使用celery作为任务运行程序。在Python 2.7下一直运行良好。最近我将电脑升级到Ubuntu 16.04,但它开始给我以下错误:
from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
ImportError: cannot import name _uuid_generate_random
完整的调用堆栈:
Traceback (most recent call last):
File "venv/bin/celery", line 7, in <module>
from celery.__main__ import main
File "venv/local/lib/python2.7/site-packages/celery/__init__.py", line 133, in <module>
from celery import five # noqa
File "venv/local/lib/python2.7/site-packages/celery/five.py", line 153, in <module>
from kombu.utils.compat import OrderedDict # noqa
File "venv/local/lib/python2.7/site-packages/kombu/utils/__init__.py", line 19, in <module>
from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
ImportError: cannot import name _uuid_generate_random
这对我来说似乎很奇怪。目前我的Python版本是:
Python 2.7.10
在2.7.x版本中是否有一些语法改变?
_uuid_generate_random
)。你可能不应该这样做,因为它们在版本之间可能会在没有任何通知的情况下发生更改... - mgilson