【问题标题】:Can someone help me with my discord bot code error? [duplicate]有人可以帮我解决我的不和谐机器人代码错误吗? [复制]
【发布时间】:2021-09-22 20:52:32
【问题描述】:

当我运行代码时它说:

Traceback(最近一次调用最后一次): 文件“C:\Users\Gebruiker\PycharmProjects\pythonProject\DiscordBot.py”,第 1 行,在 导入不和谐 ModuleNotFoundError: 没有名为“discord”的模块

知道如何解决这个问题,请帮助我。

【问题讨论】:

标签: python pycharm discord discord.py bots


【解决方案1】:

您可以使用以下方法安装不和谐:

pip install discord

如果您使用的是 anaconda,请从 PyCharm 检查您的 python 解释器。转至File->Settings->Project Settings->Project Interpreter->Python Interpreters 确保选择正确的python.exe版本

例如

  • 对于裸python(为此您需要安装 discord )C:\Users\xxx\AppData\Local\Programs\Python\Python38\Lib (类似这样的路径)

  • 对于 anaconda,你会看到 C:\Users\xxx\AppData\Local\Continuum\anaconda3\python.exe

选择正确的口译员,一切顺利

无论如何,我建议你花时间学习一下虚拟环境 https://docs.python.org/3/library/venv.html

【讨论】:

    猜你喜欢
    • 2021-02-26
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-09
    • 1970-01-01
    • 2019-09-23
    相关资源
    最近更新 更多