当前位置:首页 » 我在 - 第1页

05月15日

(Python)asyncio使用异常:This event loop is already running解决方式_阿良的博客

发布 : zsy861 | 分类 : 《随便一记》 | 评论 : 0 | 浏览 : 675次
(Python)asyncio使用异常:This event loop is already running解决方式_阿良的博客

问题背景asyncio是Python3.4版本引入的标准库,直接内置了对异步IO的支持。最近我在多线程调用使用asyncio方法的时候,出现报错:Thiseventloopisalreadyrunning后来查过一些资料,发现asyncio不允许嵌套事件出现,需要引入nest_asyncio。问题解决引入nest_asyncio模块pipinstallnest_asyncio-ihttps://pypi.douban.com/simple代码添加importnest_asyncionest_asyncio.a

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1