问题:
from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (C:\python38\lib\site-packages\django\utils\translation\__init__.py)
解决方法:
采用低版本的Django,比如 Django 2.X
==============================
'ugettext_lazy' has been deprecated for django 3+ so you won’t be able to use that with a django version >= 3. https://code.djangoproject.com/ticket/30165
==============================
One answer is ugettext_lazy has been removed in Django 4.0 57. Please use gettext_lazy instead ""
from django.utils.translation import gettext_lazy as _
I have solved the problem by installing the django==3.2 instead of the latest version of Django. But I`ll still check for the pypi update for the usage in the latest version of Django.
==============================
REF
https://stackoverflow.com/questions/70656495/importerror-cannot-import-name-ugettext-lazy
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。