django 模块未找到错误:没有名为“celery”的模块

daolsyd0  于 2022-12-14  发布在  Go
关注(0)|答案(1)|浏览(264)

我确信我已经用pip install celery安装了celepie。我正在Docker上运行我的Django应用程序。当我运行命令docker compose up时,它显示了错误。

File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
batch_email-web-1  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
batch_email-web-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
batch_email-web-1  |   File "/Batch_Email/Batch_Email/__init__.py", line 1, in <module>
batch_email-web-1  |     from .celery import app as celery_app
batch_email-web-1  |   File "/Batch_Email/Batch_Email/celery.py", line 4, in <module>
batch_email-web-1  |     from celery import Celery
batch_email-web-1  | ModuleNotFoundError: No module named 'celery'

在安装celery之前,命令docker compose up会运行Django服务器。我已经安装了使用celery的Redis。为什么我会收到这个错误,我该如何修复它?

n3ipq98p

n3ipq98p1#

您正在使用名为celery的文件,该文件与名为celery的软件包类似。请将本地文件重命名为类似celery_helper.py的名称或与软件包名称不同的名称。

相关问题