解决:cannot import name ‘Literal‘ from ‘typing‘
解决二:换为from typing_extensions import Literal。类型提示是在 Python 3.8 中引入的。在 Python 3.7 中,解决一:升级python。
·
from typing import Tuple, Literal
ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)
理由:因为 Literal 类型提示是在 Python 3.8 中引入的。在 Python 3.7 中,Literal 并不存在于 typing 模块中,所以会出现 ImportError 错误
解决一:升级python
解决二:换为from typing_extensions import Literal
昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链
更多推荐


所有评论(0)