如何解决DeprecationWarning:不建议使用“集合”而不是“ collections.abc”中的ABC或从其中导入ABC,在3.8中它将停止工作
我从github下载了一个代码,并试图通过在git bash中运行命令来按原样运行它:python manage.py runserver
但是我遇到此错误:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated,and in 3.8 it will stop working
已按照此答案How to use collections.abc from both Python 3.8+ and Python 2.7中的建议对我的manage.py文件进行了更改 但仍然面临相同的错误。
import os
import sys
try:
from collections.abc import Callable
except ImportError:
from collections import Callable
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE","app.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。