ModuleNotFoundError:即使在重新检查我已安装该软件包后,也没有名为“channels”的模块

问题描述 投票:0回答:2

我的软件包有问题,我已经使用 pip installchannels 命令安装了 djangochannels(只是通道),当我尝试运行服务器命令时,我刚刚收到一个错误,说模块未找到,但当我运行命令时

pip list | grep channels

安装了两个模块

channels                            2.1.6
channels-redis                      2.3.3

我不知道错误背后的原因 有人可以帮我弄清楚我是否做错了什么

我已将它们添加到 settings.py 的已安装应用程序部分中

完整追溯

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0458E780>
Traceback (most recent call last):
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\core\management\commands\runserver.py", line 112, in i
nner_run
    autoreload.raise_last_exception()
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exceptio
n
    raise _exception[1]

  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\core\management\__init__.py", line 327, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\apps\registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\madhumani\workspace\ven\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "C:\Users\madhumani\workspace\ven\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'channels'
django django-models django-channels
2个回答
0
投票

同样的事情也发生在我身上。我只是执行

pip install channels
就成功了。


0
投票

您可能忘记在 settings.py INSTALLED_APPS 中写入逗号。

© www.soinside.com 2019 - 2024. All rights reserved.