我正在运行django项目,当我尝试使用命令添加超级用户时出现此错误
python manage.py createsuperuser
我得到的错误是
>File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
>File "/home/boidot/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
>File "/home/boidot/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
>File "/home/boidot/anaconda3/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
>File "/home/boidot/anaconda3/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
>File "/home/boidot/anaconda3/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
>File "/home/boidot/anaconda3/lib/python3.6/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 'social_django'
然而我认为我在虚拟环境中安装了所有必需的软件包。
pip freeze
certifi==2018.1.18
chardet==3.0.4
click==6.7
dash==0.19.0
dash-core-components==0.14.0
dash-html-components==0.8.0
dash-renderer==0.11.1
dash-table-experiments==0.5.4
decorator==4.2.1
defusedxml==0.5.0
Django==2.0.2
django-admin==1.1.1
django-excel-response2==2.0.8
django-six==1.0.4
django-social-auth==0.7.28
Flask==0.12.2
Flask-Compress==1.4.0
httplib2==0.10.3
idna==2.6
ipython-genutils==0.2.0
itsdangerous==0.24
Jinja2==2.10
jsonschema==2.6.0
jupyter-core==4.4.0
MarkupSafe==1.0
nbformat==4.4.0
numpy==1.14.0
oauth2==1.9.0.post1
oauthlib==2.0.6
panda==0.3.1
pandas==0.22.0
plotly==2.3.0
PyJWT==1.5.3
python-dateutil==2.6.1
python-openid==2.2.5
python-social-auth==0.3.6
python3-openid==3.1.0
pytz==2017.3
requests==2.18.4
requests-oauthlib==0.8.0
screen==1.0.1
six==1.11.0
social-auth-app-django==2.1.0
social-auth-core==1.6.0
traitlets==4.3.2
urllib3==1.22
Werkzeug==0.14.1
xlwt==1.3.0
我在pip freeze
结果中没有social_django,但是当我运行时
pip3 install social_django I get
Could not find a version that satisfies the requirement social_django (from versions: )
No matching distribution found for social_django
我已经尝试过manage.py
文件的其他命令(比如基本的shell
),我得到了同样的错误。你能帮忙吗?
答案 0 :(得分:0)
如果您想使用社交身份验证,那么您还需要安装django app。
pip install python-social-auth[django]
答案 1 :(得分:0)
Social_Django是&#34; social-auth-app-django&#34;的模块。 所以只需运行此命令
pip install social-auth-app-django