0

我不明白为什么我会遇到这个问题,我遵循了安装指南的大部分步骤:https
://dj-rest-auth.readthedocs.io/en/latest/installation.html 除了我使用pipenv install.
但是,python manage.py migrate给了我这个错误:

    main()
  File "/home/ryan/Documents/is4103/is4103-capstone-id01/Backend/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute
    django.setup()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/config.py", line 223, in create
    import_module(entry)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dj_rest_auth'

设置.py

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'BackendApp',
    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',
]

点文件

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
django = "*"
psycopg2-binary = "*"
django-polymorphic = "*"
pillow = "*"
djangorestframework = "*"
markdown = "*"
django-filter = "*"
dj-rest-auth = "*"

[dev-packages]

[requires]
python_version = "3.9"

编辑:这个 repo 在 github 上,所以我重新克隆它并尝试过,但同样的错误。

4

1 回答 1

1

编辑:我错了,这是因为我在pipenv shell安装时不在环境中dj_auth_rest

老错误答案:

我的 Anaconda 不知何故导致了这个问题。

我曾经conda deactivate解决这个问题。

于 2022-02-10T06:29:10.970 回答