我正在GCP上运行一个基于Django 4.1.3的REST API,Django Generic Relation包抛出了一个错误:
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/local/lib/python3.8/site-packages/django/utils/translation/__init__.py)
程序包跟踪为:
File "/usr/local/lib/python3.8/site-packages/generic_relations/serializers.py", line 2, in <module> from django.utils.translation import ugettext_lazy as _
我更新了venv/lib/python3.8/sitepackages/generic_relations/ www.example.com中的序列化程序serializers.py从
from django.utils.translation import ugettext_lazy as _ TO
from django.utils.translation import gettext_lazy as _
上面的不起作用!更新软件包本身是我尝试修复的最后手段,因为我的代码中的所有导入语句都已经被修复了。感谢帮助。
这是我的要求. txt
-i https://pypi.python.org/simple
appdirs==1.4.4
bandit==1.5.1
beautifulsoup4==4.9.3
boto3==1.16.0
botocore==1.19.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2;
colorama==0.4.4;
colorlog==6.7.0
coverage==5.3
croniter==1.3.8;
decorator==4.4.2
django-amazon-ses==4.0.0
django-appconf==1.0.4
django-cacheops==6.1
django-cursor-pagination==0.2.0
django-extensions==3.0.9
django-imagekit==4.1.0
django-media-fixtures==0.0.3
django-model-utils==4.2.0
django-modeltranslation==0.18.7
django-nose==1.4.7
django-ordered-model==3.4.1
django-positions==0.6.0
django-proxy==1.2.1
django-redis==4.12.1
django-replicated==2.7
django-rq-scheduler==2022.11
django-rq==2.6.0
django-storages==1.13.1
django==4.1.3
djangorestframework>=3.13.1,!=3.14.0
django-utils-six==2.0
django-upgrade==1.12.0
six==1.16.0
dparse==0.5.1;
faker==0.9.1
ffmpy==0.2.3
filelock==3.0.12
funcy==1.15
gitdb==4.0.5;
gitpython==3.1.9;
halo==0.0.30
idna==2.10;
importlib-metadata==2.0.0;
jmespath==0.10.0;
langdetect==1.0.8
log-symbols==0.0.14
mixer==6.1.3
mysqlclient==2.1.1
natsort==7.0.1;
networkx==2.5;
nose-exclude==0.5.0
nose==1.3.7
numpy==1.19.2;
onesignal-sdk==1.1.0
packaging==20.4;
pathtools==0.1.2
pbr==5.5.1;
pilkit==2.0
pillow==8.0.0
pinocchio==0.4.2
pyjwt==1.7.1
pyparsing==2.4.7;
python-dateutil==2.8.1;
python-dotenv==0.14.0
python-magic==0.4.27
pytz==2022.6
pyyaml==5.3.1
redis==3.5.3
requests-file==1.5.1
requests==2.24.0;
rest-framework-generic-relations==2.1.0
rq-scheduler==0.11.0
rq==1.5.2;
s3transfer==0.3.3
safety==1.9.0
sentry-sdk==0.10.2
shutilwhich==1.1.0
smmap==3.0.4;
soupsieve==2.0.1;
spectra==0.0.11
spinners==0.0.24
sqlparse==0.4.1;
stevedore==3.2.2;
termcolor==1.1.0
text-unidecode==1.2
tldextract==2.2.3
toml==0.10.1
uritools==3.0.0;
url-normalize==1.4.3
urlextract==1.7.1
urllib3==1.25.11;
watchdog==0.10.3
webpreview==1.6.0
zipp==3.3.1;
mysql-connector-python==8.0.26
1条答案
按热度按时间2izufjch1#
您是否在不使用虚拟环境的情况下尝试过它,因为您目前正在使用它