【发布时间】:2021-03-27 17:26:58
【问题描述】:
我正在尝试运行我的 discord 机器人,但后来我继续得到:
raise ClientConnectorCertificateError(aiohttp.client_exceptions.ClientConnectorCertificateError:
Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]
我的代码是
import discord
from discord.ext import commands
client = commands.Bot(command_prefix="$")
@client.event
async def on_ready():
print("Bot is ready")
@client.command()
async def hello(ctx):
await ctx.send("hey")
client.run("-------------------------------------")
【问题讨论】:
-
这是 SSL 的问题 - 也许你必须安装更新的 OpenSSL。它不是 Python 模块,而是许多程序使用
SSL连接互联网的 C/C++ 库 - Python 也使用它。