Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm creating a discord bot, but when I try to import discord, I am getting this error:

Traceback (most recent call last):
  File "C:UsersSomeoneDesktopDiscord botot.py", line 2, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
[Finished in 0.5s]

I opened a terminal ctrl + ~ and typed:

pip install discord.py

And I have got this error:

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

Can anyone help me?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
152 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...