ImportError: cannot import name 'TypedDict' from 'typing_extensions'
See original GitHub issue问题描述
在pip上更新了 nonebot ( nonebot/nonebot )(pip install --upgrade nonebot),更新过程中同时将aiocqhttp更新到了版本1.4.0,Quart更新到了0.14.1,hypercorn更新到了版本0.11.2。然后试图运行nonebot,在import nonebot处报错。试图在python的互动式界面中输入import nonebot 或 import aiocqhttp报相同的错误。见下面贴的报错信息。
复现方法 见上。
期望的行为 正常import相关库而不报错?
日志信息
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\hypercorn\typing.py", line 9, in <module>
from typing import Literal, Protocol, TypedDict
ImportError: cannot import name 'Literal' from 'typing' (C:\Program Files\Python37\lib\typing.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bot.py", line 3, in <module>
import nonebot
File "C:\Program Files\Python37\lib\site-packages\nonebot\__init__.py", line 5, in <module>
import aiocqhttp
File "C:\Program Files\Python37\lib\site-packages\aiocqhttp\__init__.py", line 19, in <module>
from quart import Quart, request, abort, jsonify, websocket, Response
File "C:\Program Files\Python37\lib\site-packages\quart\__init__.py", line 6, in <module>
from .app import Quart
File "C:\Program Files\Python37\lib\site-packages\quart\app.py", line 32, in <module>
from hypercorn.asyncio import serve
File "C:\Program Files\Python37\lib\site-packages\hypercorn\asyncio\__init__.py", line 4, in <module>
from .run import worker_serve
File "C:\Program Files\Python37\lib\site-packages\hypercorn\asyncio\run.py", line 11, in <module>
from .lifespan import Lifespan
File "C:\Program Files\Python37\lib\site-packages\hypercorn\asyncio\lifespan.py", line 4, in <module>
from ..typing import ASGIFramework, ASGIReceiveEvent, ASGISendEvent, LifespanScope
File "C:\Program Files\Python37\lib\site-packages\hypercorn\typing.py", line 11, in <module>
from typing_extensions import Literal, Protocol, TypedDict # type: ignore
ImportError: cannot import name 'TypedDict' from 'typing_extensions' (C:\Program Files\Python37\lib\site-packages\typing_extensions.py)
相关代码 无
运行环境
- 操作系统:Windows server 2012 R2, x64
- OneBot(CQHTTP)实现及版本:无关
- aiocqhttp 版本:1.4.0
- Python 版本:3.7.3
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Trying to import TypedDict from typing of tpying_extensions fails
I have code that runs on Python 3.8 and Python 3.7, but I'd rather not install typing_extensions when it isn't need.
Read more >cannot import name 'TypeGuard' from 'typing_extensions'
I am new to Python and found the following error with swmmtoolbox package. I would really appreciate your comments. Thanks.
Read more >Cannot import _TypedDictMeta from typing_extensions
... i get the error “ImportError: cannot import name _Typed… ... older version of typing-extensions package which is not compatible with a ...
Read more >typing-extensions - PyPI
The typing_extensions module serves two related purposes: Enable use of new type system features on older Python versions. For example, typing.
Read more >More types - mypy 0.991 documentation
TypedDict lets you give precise types for dictionaries that represent ... from typing import NoReturn def stop() -> NoReturn: raise Exception('no way').
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hypercorn 的問題,依賴沒有安裝全.
解決辦法 1:使用 Python 3.8
解決辦法 2:
pip install typing_extensionsOn Sun., May 16, 2021, 17:49 user670, @.***> wrote:
I have submitted this bug to hypercorn. They might update this in the future.
https://gitlab.com/pgjones/hypercorn/-/merge_requests/54
On Sun., May 16, 2021, 18:04 user670, @.***> wrote: