ModuleNotFoundError/cookiecutter

2024-09-19 23:34:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试通过诗歌运行命令,并不断出现以下错误:

Traceback (most recent call last):
  File "manage.py", line 30, in <module>
    execute_from_command_line(sys.argv)
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/__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 "/mnt/c/users/lisa/documents/github/pollsapi_w_template/pollsapi_w_template/users/models.py", line 11, in <module>
    from pollsapi_w_template.users.emails import RestorePasswordEmail, VerificationEmail
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/pollsapi_w_template/users/emails.py", line 3, in <module>
    from snitch.emails import TemplateEmailMessage
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/snitch/emails.py", line 11, in <module>
    from snitch.tasks import send_email_asynchronously
  File "/mnt/c/users/lisa/documents/github/pollsapi_w_template/.venv/lib/python3.8/site-packages/snitch/tasks.py", line 3, in <module>
    from celery.task import task
ModuleNotFoundError: No module named 'celery.task'

我在通过poetry.toml创建的虚拟环境中,例如,我正在尝试运行poetry run python manage.py migrate

我尝试了poetry add celery,结果如下:

RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

Updating dependencies
Resolving dependencies... (1.9s)

Writing lock file

No dependencies to install or update

Tags: inpyimportgithubvenvliblinetemplate
1条回答
网友
1楼 · 发布于 2024-09-19 23:34:11

我解决了,这是一个版本错误:芹菜5.0似乎没有任务模块

我通过运行poetry add celery@4.4.0解决了这个问题

相关问题 更多 >