PyCharm不会运行Discord模块,尽管它已经安装

2024-04-28 21:07:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我是一个Pycharm初学者,因为我已经从spyder转换过来了。现在,在转移到Pycharm之后,出现了新的问题

正如一些人可能知道的那样,Python适合制作不和谐的机器人。我在终端中使用pip install安装discord包,然后开始编写代码。运行后,控制台将返回: ModuleNotFoundError: No module named 'discord'

以下代码供参考:


    # Marble Police
    import discord
    from discord.ext import commands

    client = commands.Bot(command_prefix="/")

    @client.event
    async def on_ready():
        print("Marble Police has been dispatched!")

    client.run({BOT TOKEN})

如果你想了解更多信息,请在下面询问我


Tags: installpip代码importclient终端机器人commands