from utils import ConfigImportError:无法导入名称“Config”

2024-05-16 07:21:54 发布

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

在python3.5中,我得到以下导入错误:

ImportError: cannot import name 'Config'

当我尝试的时候

^{pr2}$

我已经检查了包utils是“piped”的。我很好奇,因为几个月前当我试图从utils导入Config时,它还可以。在


Tags: nameimportconfig错误utilspipedimporterrorpr2
1条回答
网友
1楼 · 发布于 2024-05-16 07:21:54

这是因为Config模块在utils包中不可用。在

如果您在import utils之后在pythonshell中尝试一个help("utils"),您会注意到utils有以下模块-

bools、dates、dicts、enum、list、math和objects,但不是Config。在

根据this文档(虽然已经过时),Config由{}使用。您可能需要尝试pip install config,看看它是否适用于您的python版本。在

如果它不工作,您可以始终使用configparser。在

相关问题 更多 >