英文:
No module named 'discord.ext'; 'discord' is not a package
问题
我正在使用Python开发一个Discord机器人,只是在尝试基础操作。
我使用以下代码启动它:
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并更改名称,但都没有起作用!请帮忙!
英文:
I am working on a discord bot in python and just trying to do the basics.
I am using this code to start it up:
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)
but i keep getting this annoying error:
from discord.ext import commands
ModuleNotFoundError: No module named 'discord.ext'; 'discord' is not a package
I am not sure why this is happenign
I have tried installing discord.py again and rechanging the name but nothing has worked! Pleasehelp!
答案1
得分: 1
pip卸载discord
pip安装discord.py
英文:
pip uninstall discord
pip install discord.py
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论