Django 找不到 allauth



我有一个名为manager的项目的venv。我在venv上安装了allauth,但我得到了这个错误:

ImportError:没有名为"allauth"的模块

pip冻结:

(manager) user@host:~/manager$ pip freeze
certifi==2018.11.29
chardet==3.0.4
defusedxml==0.5.0
Django==2.1.4
django-allauth==0.38.0
django-crispy-forms==1.7.2
idna==2.8
oauthlib==2.1.0
python3-openid==3.1.0
pytz==2018.7
requests==2.21.0
requests-oauthlib==1.0.0
urllib3==1.24.1
(manager) reiser@assets:~/manager$ pip freeze
certifi==2018.11.29
chardet==3.0.4
defusedxml==0.5.0
Django==2.1.4
django-allauth==0.38.0
django-crispy-forms==1.7.2
idna==2.8
oauthlib==2.1.0
python3-openid==3.1.0
pytz==2018.7
requests==2.21.0
requests-oauthlib==1.0.0
urllib3==1.24.1

设置.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'invoices',
'feedback',
'crispy_forms',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
]

django运行服务器错误:

user@host:~/manager/src$ python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7ff29b7c8d08>
Traceback (most recent call last):
File "/home/reiser/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/reiser/.local/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/reiser/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/home/reiser/.local/lib/python3.5/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/home/reiser/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/reiser/.local/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/reiser/.local/lib/python3.5/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/reiser/.local/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'allauth'

构建venv:时使用的Python版本也是3.5

There are 2 choices for the alternative python (providing /usr/bin/python).
Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.5   2         auto mode
1            /usr/bin/python2.7   1         manual mode
2            /usr/bin/python3.5   2         manual mode
Press <enter> to keep the current choice[*], or type selection number: 

我做错了什么?

我还必须提到,在重新启动计算机之前,它工作时没有出现错误。电脑是Debian 9。

此错误表示找不到模块。

您可能只需要在服务器上安装名为allauth的第三方模块(或将其添加到requirements.txt中(

pip install django-allauth

您可以在本地运行pip-freeze来查看安装了哪些模块。

要安装特定版本的django-allauth,请使用:

pip install django-allauth==0.32.0

最新更新