繁体   English   中英

ModuleNotFoundError:没有名为'rest_framework'的模块python3 django

[英]ModuleNotFoundError: No module named 'rest_framework' python3 django

我从博客中复制了代码,但出现此错误。 实际上我也是 Django 和 stackoverflow 的新手。 我从 github 博客复制了代码,所以很容易达到我的目标。

line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'rest_framework'

复制的代码是

 from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager from phonenumber_field.modelfields import PhoneNumberField ) class Address(models.Model): address_line = models.CharField( _("Address"), max_length=255, blank=True, null=True ) street = models.CharField( _("Street"), max_length=55, blank=True, null=True) city = models.CharField(_("City"), max_length=255, blank=True, null=True) state = models.CharField(_("State"), max_length=255, blank=True, null=True) postcode = models.CharField( _("Post/Zip-code"), max_length=64, blank=True, null=True ) country = models.CharField( max_length=3, choices=COUNTRIES, blank=True, null=True) return address

pip3 install djangorestframework

settings.py

已安装的应用程序

'rest_framework',

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM