gpt4 book ai didi

python - 没有名为 'discord.ext' 的模块; 'discord' 不是一个包

转载 作者:行者123 更新时间:2023-12-02 22:47:30 28 4
gpt4 key购买 nike

我正在用 python 开发一个不和谐的机器人,只是尝试做基础知识。

我正在使用此代码来启动它:

import discord
from discord.ext import commands
print("running")
client =commands.Bot(command_prefix = "c!")

@client.command()
async def hello(ctx):
await ctx.send("hello")

client.run(token)

但我不断收到这个恼人的错误:

from discord.ext import commands
ModuleNotFoundError: No module named 'discord.ext'; 'discord' is not a package

我不知道为什么会发生这种情况

我尝试再次安装discord.py并重新更改名称,但没有任何效果!请帮忙!

最佳答案

pip uninstall discord
pip install discord.py

关于python - 没有名为 'discord.ext' 的模块; 'discord' 不是一个包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76748783/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com