当我尝试导入discord模块时出现了此错误,我使用pip install discord安装了它,我正在使用pip版本10.0.1和python 3.7
import discord File "C:\Users\chino\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\chino\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 38, in <module> from .state import ConnectionState File "C:\Users\chino\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 36, in <module> from . import utils, compat File "C:\Users\chino\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32 create_task = asyncio.async ^ SyntaxError: invalid syntax
答案 0 :(得分:0)
Discord.py与github上所述的Python 3.7不兼容。他们提交了修复程序,但尚未发布,因此您可以降级到Python 3.6或在此提交时手动更改文件:
https://github.com/Rapptz/discord.py/commit/096584733e8a8025b13f46fa920e18abe19352c1
或者,如果您确实需要python 3.7,则可以按照他们的建议使用其更新的for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.print(grid[j][i] + " ");
}
System.out.println("");
}
分支,该分支已提供此修复程序