使用discord.py模块创建discord bot时出错。我认为这与使用anaconda进行安装有关

时间:2018-10-06 22:20:59

标签: python anaconda discord discord.py

如果我在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可以识别模块

1 个答案:

答案 0 :(得分:0)

尝试使用pip安装discord.py模块(“ pip install discord.py”)!