我正在尝试导入ArrayLike do from numpy.typing import ArrayLike,并且收到标题中提到的错误:
from numpy.typing import ArrayLike
ModuleNotFoundError: No module named 'numpy.typing'
我知道我可以简单地import numpy.typing as npt按照文档所示进行编写,但我希望能够简单地导入我想要使用的类型。这也不是我第一次遇到这种情况:我想导入特定的方法/类,但我被迫使用昵称导入父模块,否则我会收到错误。为什么?
import numpy.typing as npt
python annotations numpy
annotations ×1
numpy ×1
python ×1