如果我在python中运行以下代码,则会出现错误。
import discord
from discord.ext import commands
TOKEN = "token"
client = commands.Bot(command_prefix = "rps/")
@client.event
async def on_ready():
print ('ready')
client.run("token")
错误:
追踪(最近一次通话):文件“ /Users/timothy/Library/Python/3.6/lib/python/site-packages/aiohttp/connector.py”,_wrap_create_connection中的第822行返回等待self._loop.create_connection(* args,** kwargs)文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py”,create_connection中的第804行sock,protocol_factory,ssl,server_hostname)文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py”,_create_connection_transport中的第830行来自服务员文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py”的产量,第505行,在data_received中ssldata,appdata = self._sslpipe.feed_ssldata(data)文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py”,feed_ssldata中的第201行self._sslobj.do_handshake()文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py”,第689行,在do_handshake中self._sslobj.do_handshake()ssl.SSLError:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:833)
上述异常是以下异常的直接原因:
追踪(最近一次通话):文件“ /用户/蒂莫西/文档/编码资料/ python / Test bot / test bot.py”,第12行client.run(TOKEN)文件“ /Users/timothy/Library/Python/3.6/lib/python/site-packages/discord/client.py”,571行返回task.result()文件“ /Users/timothy/Library/Python/3.6/lib/python/site-packages/discord/client.py”,第478行,开始
我认为这与如何使用$ conda install discord.py安装软件包有关。有人知道我做错了吗? python可以识别模块
尝试使用pip安装discord.py模块('pip install discord.py')!