为什么asyncio_ensure_future = asyncio.async会引发SyntaxError:无效语法

时间:2018-07-11 19:01:22

标签: python-3.x discord.py

我一直在互联网上寻找答案,但没有任何反应。

我认为这可能非常罕见。 看来我是唯一一个诚实的人。

这里是V出现的错误

import discord File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\__init__.py", line 20, in <module> from .client import Client, AppInfo, ChannelPermissions File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 42, in <module> from .voice_client import VoiceClient File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\voice_client.py", line 43, in <module> import websockets File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\__init__.py", line 3, in <module> from .client import * File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\client.py", line 12, in <module> from .protocol import CONNECTING, OPEN, WebSocketCommonProtocol File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\protocol.py", line 17, in <module> from .compatibility import asyncio_ensure_future File "C:\Users\hmm46\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\compatibility.py", line 9 from asyncio import async as asyncio_ensure_future ^ SyntaxError: invalid syntax

我使用最新版本的python 3.7.0。

相信我,我一直在花15至20分钟的时间来寻求解决方案, 是我的天才

1 个答案:

答案 0 :(得分:0)

discord.py中提供的pip版本不支持Python 3.7(因为asyncawait是关键字)

尝试从Github下载该库的最新开发版本

python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice]