ModuleNotFoundError: No module named 'allauth' when trying to createsuperuser

ModuleNotFoundError: No module named 'allauth' when trying to createsuperuser

所以,我是 Django 的新手,为了学习,我试图在扩展 AbstractBaseUser 的同时使用 allauth 启动一个项目。 项目启动,没有问题,allauth 的登录屏幕显示我的自定义模型(使用电子邮件登录)。但是当我尝试创建超级用户时,出现以下错误。

    Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "C:\users\bramv\appdata\local\programs\python\python38\lib\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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'allauth'

我确实设置了一个 virtualenv 并使用 pip 安装了 django-allauth,我按照 django-allauth 文档中的安装说明进行操作。我看不出这个错误是从哪里来的,任何帮助将不胜感激。

先安装库。在您的控制台中:

pip install django-allauth