ImportError:无法导入名称“upath”Django 3

2024-06-26 01:34:35 发布

您现在位置:Python中文网/ 问答频道 /正文

如何解决导入错误

示例代码:

from django.utils._os import upath

dirs = [upath(os.path.abspath(os.path.realpath(d))) for d in dirs]
  • Django 3.2

Tags: pathdjango代码infromimport示例for
1条回答
网友
1楼 · 发布于 2024-06-26 01:34:35

根据:https://docs.djangoproject.com/en/3.2/releases/3.0/

django.utils._os.upath() and npath() - These functions do nothing on Python 3.

所以,看起来我们可以去掉这个用法

dirs = [os.path.abspath(os.path.realpath(d)) for d in dirs]

相关问题 更多 >