【问题标题】:I was writing the python code for discord and i imported the discord packages. As soon as i run the code its said no attribute name Client in discord我正在为 discord 编写 python 代码,并导入了 discord 包。一旦我运行代码,它就说没有属性名称客户端不和谐
【发布时间】:2022-01-25 10:19:01
【问题描述】:

导入不和谐 client = discord.Client()

AttributeError: 部分初始化的模块 'discord' 没有 属性“客户端”(很可能是由于循环导入)

首先,我像往常一样编写代码。我完成了我的 python 代码并运行了它。 有一个错误,它说“他们在 dicord.py 中找不到客户端”所以我卸载它并再次运行它但没有工作。

帮帮我,先生。我已经写了6天了。 推特

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: python discord package


【解决方案1】:

你的代码应该是:

import discord
from discord.ext import commands
client = commands.Bot(command_prefix='<your prefix>')

【讨论】:

  • 它说在 discord.py 中找不到命令先生。我也可以在我的电脑磁盘中找到这个包。
  • 你试过编码吗?使用from discord.ext import commands
猜你喜欢
  • 2022-11-23
  • 2019-09-29
  • 1970-01-01
  • 2020-03-24
  • 2018-03-09
  • 2013-01-26
  • 1970-01-01
  • 1970-01-01
  • 2011-10-08
相关资源
最近更新 更多