0

我正在运行一个 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

结果中没有social_django pip freeze,但是当我运行时

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文件的其他命令(如 basic shell),我得到了同样的错误。你能帮我吗 ?

4

2 回答 2

1

Social_Django 是“social-auth-app-django”的模块,所以只需运行这个命令

pip install social-auth-app-django
于 2018-05-18T10:05:22.717 回答
0

如果你想使用社交认证,那么你还需要安装 django 应用程序。

pip install python-social-auth[django]
于 2018-02-06T04:29:37.637 回答