[英]python3 ModuleNotFoundError: No module named 'rest_framework_jwt'
我想从 jwt 导入,但在第 12 行出现错误,来自 rest_framework_jwt.settings import api_settings ModuleNotFoundError: No module named 'rest_framework_jwt'
For python 3对于蟒蛇 3
pip3 install djangorestframework-jwt
For python 2 and python对于 python 2 和 python
pip install djangorestframework-jwt
Verify your installation, it's a separated package: pip install djangorestframework-jwt验证您的安装,它是一个单独的包: pip install djangorestframework-jwt
Also, try to include this in the settings.py: REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.BasicAuthentication', ), }此外,尝试将其包含在 settings.py 中: REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONAuthentication.JSONWebframeAuthentication' , 'rest_framework.authentication.BasicAuthentication', ), }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.