【发布时间】:2020-07-25 13:19:12
【问题描述】:
我是 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})
如果您想了解更多信息,请在下方询问我。
【问题讨论】:
-
只需查看您的项目解释器并在其中安装模块并运行该 python 解释器
-
在 PyCharm 中打开内置终端界面并执行 pip install discord,以确保您将其安装在正确的 virtualenv 中。在此之前,请确保为您想要的项目选择了正确的解释器(右下角)。
-
好的,问题解决了,但问题更多
-
我们需要有关您的环境的更多信息。您确定将库安装到用于运行程序的同一 Python 安装中吗?
-
哦,我已经解决了所有问题