gpt4 book ai didi

带有 Django : ImportError: No module named 'openid.association' 的 python-social-auth

转载 作者:太空宇宙 更新时间:2023-11-04 08:02:14 24 4
gpt4 key购买 nike

我正在尝试将 python-social-auth 与 Django 1.9 和 Python 3 一起使用。据我所知,我已经安装了所有必要的要求,并且在我的设置.py。但是,当我尝试运行迁移或运行 Django 开发服务器时,出现以下错误:

ImportError: No module named 'openid.association'

完整回溯如下:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f6fe7ea5a60>
Traceback (most recent call last):
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/home/ethan/.virtualenvs/flywithme/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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/social/apps/django_app/default/models.py", line 9, in <module>
from social.storage.django_orm import DjangoUserMixin, \
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/social/storage/django_orm.py", line 5, in <module>
from social.storage.base import UserMixin, AssociationMixin, NonceMixin, \
File "/home/ethan/.virtualenvs/flywithme/lib/python3.5/site-packages/social/storage/base.py", line 12, in <module>
from openid.association import Association as OpenIdAssociation
ImportError: No module named 'openid.association'

我在搜索中发现的一个建议是删除 python-openid 并安装 python3-openid。这对我不起作用。我还看到了一些与 ImportErrorpython-social-auth 相关的帖子,但未能提出适合我的解决方案。我假设我配置错误/未能配置某些东西,但我不确定是什么。我在这里做错了什么?

最佳答案

我只是遇到了完全相同的问题(Python 3.5、Django 1.9.8),实际上可以通过卸载 所有 版本的 python-openid 然后删除并重新安装 python-social-auth.

安装 PSA 时似乎出现了问题,而 python-openid 仍然可用。因此,请确保删除两个版本,即 python-openid 和 python3-openid,然后也删除 PSA 并尝试重新安装。在日志中,您现在应该看到 python3-openid 与 PSA 一起安装。这样做之后,我可以毫无问题地应用所有迁移。

如果这对您不起作用。不安装 python3-openid,您也可以尝试使用 pip install git+https://github.com/omab/python-social-auth.git 从 git 安装 PSA .显然,这帮助了一年前遇到类似问题的人 (https://github.com/omab/python-social-auth/issues/588)。

希望对您有所帮助!

关于带有 Django : ImportError: No module named 'openid.association' 的 python-social-auth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38078340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com