gpt4 book ai didi

python - celery :多次导入失败

转载 作者:行者123 更新时间:2023-11-28 17:28:04 26 4
gpt4 key购买 nike

我正在使用 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 已被移除,取而代之的是 os.urandom

https://hg.python.org/releases/2.7.11/rev/24bdc4940e81

关于python - celery :多次导入失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36962712/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com