[英]ModuleNotFoundError: No module named 'rest_framework.response'
in windows在 windows
from rest_framework import serializers
is working.工作中。 but in 'view.py' file
但在“view.py”文件中
from rest_framework.response import Response
is not working.不管用。
please help!请帮忙!
I checked 'setting.py' file, pip list and runserver state.我检查了“setting.py”文件、pip 列表和运行服务器 state。
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mood',
'rest_framework',
]
$ pip list
Package Version
--------------------- -------
asgiref 3.3.1
Django 3.1.6
pip 21.0.1
Python-Rest-Framework 0.3.14
pytz 2021.1
setuptools 41.2.0
six 1.15.0
sqlparse 0.4.1
(venv)
ModuleNotFoundError: No module named 'rest_framework.response'
what should i do......我应该怎么办......
You have installed python-rest-framework
not django-rest-framework
.您已安装
python-rest-framework
而不是django-rest-framework
。 your import statements are correct, but not the installed package.您的导入语句是正确的,但不是安装的 package。
Python-Rest-Framework 0.3.14
Python-Rest-Framework 0.3.14
Use this to install DRF:使用它来安装 DRF:
pip install djangorestframework
You Should Install Django REST framework but you have Installed Python Rest framework.您应该安装 Django REST 框架,但您已经安装了 Python Z55276C10D84E1DF7713B44 框架。 To install Django Rest framework please Install the rest framework with below code.
要安装 Django Rest 框架,请使用以下代码安装 rest 框架。
pip install djangorestframework
pip3 install djangorestframework pip3 安装 djangorest 框架
i used this command on windows and it is solved我在 windows 上使用了这个命令,它已经解决了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.