ModuleNotFoundError:没有名为“discord.commands.__init__.context”的模块;

发布于 2025-01-10 05:12:17 字数 577 浏览 4 评论 0原文

我目前正在开发一个使用不和谐命令控制我的电脑的程序。对于不和谐库,我使用 Pycord。将文件转换为可执行文件后,显示错误:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
  File "PyInstaller\loader\pyimod03.py", line 495, in exec_module
  File "discord\__init__.py", line 33, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495 in exec_module
  File "discord\commands\__init__.py", line 26, in <module>
ModuleNotFoundError: No module named 'discord.commands.__init__.context'
[16680] Failed to execute script 'main' due to unhandled exception

I'm currently working on a program that controls my PC with discord commands. For discord library, I use Pycord. After converting the file into an Executable file, it shows the error:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
  File "PyInstaller\loader\pyimod03.py", line 495, in exec_module
  File "discord\__init__.py", line 33, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495 in exec_module
  File "discord\commands\__init__.py", line 26, in <module>
ModuleNotFoundError: No module named 'discord.commands.__init__.context'
[16680] Failed to execute script 'main' due to unhandled exception

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

记忆で 2025-01-17 05:12:17

我遇到了同样的问题,这对我有用:

pip uninstall discord
pip uninstall discord.py
pip uninstall py-cord

然后:

pip install discord

我安装了与 Discord 相关的不同库,所以我认为这就是问题 <3

I had the same issue and this worked for me:

pip uninstall discord
pip uninstall discord.py
pip uninstall py-cord

Then:

pip install discord

I had installed a different library related to Discord, so I think that was the issue <3

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文