没有名为"discord"的模块 [英] No module named 'discord'

查看:62
本文介绍了没有名为"discord"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Sublime Text编码discord bot,但是当我尝试导入discord时,出现错误:

I'm using Sublime Text to code discord bot, but when i try to import discord, i've got error:

Traceback (most recent call last):
  File "C:\Users\Someone\Desktop\Discord bot\bot.py", line 2, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
[Finished in 0.5s]

我打开了一个终端(ctrl +〜)并写道: pip install discord.py 我有这个错误:

I opened a terminal (ctrl + ~) and wrote: pip install discord.py And I have got this error:

  File "<string>", line 1
    pip install discord.py
              ^
SyntaxError: invalid syntax

有人可以帮助我吗?

推荐答案

Ctrl (实际上是 Ctrl `)终端"实际上不是命令行终端,而是Python REPL.在Windows中,通过单击 Win R 打开命令提示符,然后键入 cmd 并单击Enter. pip install discord.py 现在应该安装 discord.py 及其所有依赖项.

The Ctrl~ (actually Ctrl`) "terminal" isn't actually a command line terminal, it's a Python REPL. Open the command prompt in Windows by hitting WinR, then typing cmd and hitting Enter. pip install discord.py should now install discord.py and all of its dependencies.

这篇关于没有名为"discord"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆