即使使用init .py也會(huì)出現(xiàn)錯(cuò)誤“嘗試在非包中進(jìn)行相對(duì)導(dǎo)入” 。pkg/ __init__.py conf/ core.py __init__.py scripts/ core_script.py __init__.py在 core_script.py 我有以下導(dǎo)入語(yǔ)句from ..conf.core import gDocsCred但是,當(dāng)我運(yùn)行時(shí),我收到以下錯(cuò)誤:scripts$ python core_test.py Traceback (most recent call last): File "core_script.py", line 3, in <module> from ..conf.core import gDocsCredValueError: Attempted relative import in non-package
嘗試在非包中進(jìn)行相對(duì)導(dǎo)入”,即使使用 __init__.py
www說(shuō)
2022-11-01 16:54:47