ModuleNotFoundError:没有名为"rest_framework"的模块 [英] ModuleNotFoundError: No module named 'rest_framework'
问题描述
我试图遵循有关DRF的教程,但是当我要运行"migrate"时,对于数据库,我得到ModuleNotFoundError:没有名为"rest_framework"的模块.
I'm trying to follow a tutorial on DRF, but when I'm about to run "migrate" for the database, i get ModuleNotFoundError: No module named 'rest_framework'.
正如PyCharm所暗示的那样,同样适用于我在那里的django_summernote和djoser.我知道有一些这样的线程,但是这些线程似乎无济于事-Python控制台确实可以识别这些模块,并且可以通过INSTALLED_APPS添加它们
As PyCharm hints, the same also applies to django_summernote and djoser I have there. I know there are some threads like this, but nothing from those seems to help - the Python console DOES recognize these modules, and they are added through INSTALLED_APPS
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'kursovik.apps.KursovikConfig',
'rest_framework',
'rest_framework.authtoken',
'django_summernote',
'djoser',
'kursovik']
我最近通过以下方式下载了这些文件
I recently downloaded these through
pip install djangorestframework
pip install djoser
pip install django-summernote
我需要重新安装它们吗?
do i need to reinstall them?
推荐答案
您必须确保PyCharm控制台使用正确的Python路径(基本上可以使用这些软件包).
You have to ensure that your PyCharm console uses the correct Python Path where the packages are available basically so to say.
转到 File/Settings/YourProject
并检查以下内容:
设置正确的路径以使程序包可用于解释程序.
Set the correct path to make the packages available for interpretation procedures.
这篇关于ModuleNotFoundError:没有名为"rest_framework"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!