简体   繁体   English

ModuleNotFoundError:没有名为“rest_framework.response”的模块

[英]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.

相关问题 ModuleNotFoundError:没有名为“rest_framework.simplejwt”的模块 - ModuleNotFoundError: No module named 'rest_framework.simplejwt' ModuleNotFoundError:没有带有virtualenv和python3.7.4的名为“ rest-framework”的模块 - ModuleNotFoundError: No module named 'rest-framework' with virtualenv and python3.7.4 ModuleNotFoundError:没有名为'rest_framework'的模块python3 django - ModuleNotFoundError: No module named 'rest_framework' python3 django ModuleNotFoundError: No module named 'rest_framework' 我已经安装了 djangorestframework - ModuleNotFoundError: No module named 'rest_framework' I already installed djangorestframework 出现错误 ModuleNotFoundError:没有名为“rest_framework_sso”的模块 - Getting error ModuleNotFoundError: No module named 'rest_framework_sso' python3 ModuleNotFoundError:没有名为“rest_framework_jwt”的模块 - python3 ModuleNotFoundError: No module named 'rest_framework_jwt' ModuleNotFoundError:运行 celery -A backend worker -l info 时没有名为“rest_framework”的模块 - ModuleNotFoundError: No module named 'rest_framework' when running celery -A backend worker -l info 没有名为rest_framework的模块 - No module named rest_framework ModuleNotFoundError:没有名为“ rango”的模块 - ModuleNotFoundError: No module named 'rango' ModuleNotFoundError: 没有名为“pkg”的模块 - ModuleNotFoundError: No module named 'pkg'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM