python - ModuleNotFoundError:没有名为“jose”的模块
问题描述
我python-social-auth
在我的 django 项目中使用社交平台在我的项目中进行身份验证。一切正常,但出现此错误ModuleNotFoundError: No module named 'jose'
这是整个错误:
[05/Apr/2020 14:01:00] "GET /accounts/login/ HTTP/1.1" 200 3058
Internal Server Error: /login/twitter/
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\social_core\backends\utils.py", line 50, in get_backend
return BACKENDSCACHE[name]
KeyError: 'twitter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Ahmed\AppData\Roaming\Python\Python37\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\Ahmed\AppData\Roaming\Python\Python37\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\Ahmed\AppData\Roaming\Python\Python37\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Ahmed\AppData\Roaming\Python\Python37\site-packages\django\views\decorators\cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\social_django\utils.py", line 46, in wrapper
backend, uri)
File "C:\Program Files\Python37\lib\site-packages\social_django\utils.py", line 27, in load_backend
Backend = get_backend(BACKENDS, name)
File "C:\Program Files\Python37\lib\site-packages\social_core\backends\utils.py", line 53, in get_backend
load_backends(backends, force_load=True)
File "C:\Program Files\Python37\lib\site-packages\social_core\backends\utils.py", line 35, in load_backends
backend = module_member(auth_backend)
File "C:\Program Files\Python37\lib\site-packages\social_core\utils.py", line 62, in module_member
module = import_module(mod)
File "C:\Program Files\Python37\lib\site-packages\social_core\utils.py", line 56, in import_module
__import__(name)
File "C:\Program Files\Python37\lib\site-packages\social\backends\google.py", line 3, in <module>
from social_core.backends.google_openidconnect import GoogleOpenIdConnect
File "C:\Program Files\Python37\lib\site-packages\social_core\backends\google_openidconnect.py", line 5, in <module>
from .open_id_connect import OpenIdConnectAuth
File "C:\Program Files\Python37\lib\site-packages\social_core\backends\open_id_connect.py", line 6, in <module>
from jose import jwk, jwt
ModuleNotFoundError: No module named 'jose'
[05/Apr/2020 14:01:06] "GET /login/twitter/?next=/accounts/login/ HTTP/1.1" 500 132103
我对python很陌生,无法弄清楚问题是什么。
解决方案
通过运行安装 jos:
pip install python-jose>=3.0.0
推荐阅读
- c - createIndexes 中的错误:无法使用数据库“mydb”发送“createIndexes”命令:无法读取 4 个字节:套接字错误或超时
- html - 如何让一个 div 作为一个盒子不跨越/离开屏幕
- django - 在这种情况下发布多种形式的同一模型的最佳方式是什么?
- vbscript - 循环一行不断增加的代码
- ruby - OpenURI 未能遵循具有 %20 的 URL
- c++ - Passing unknown size std::Array in a function with template. How can I correct this code?
- java - File/ontology (turtle, N3, JSON, RDF-XML) etc to .ttl file conversions in java
- arrays - Inteligent subtraction of values in array (php)
- python - 如何使用 putty 安装 Python3
- python - Django / MySQL唯一约束如何将NULL视为平等