Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'discord'

Trying to run my .py file from CMD, but it can't find the discord module

>>File 'C:\Users\\****\Desktop\Discord_Bot\main.py', line 1, in module

>>import discord 

>>ModuleNotFoundError: No module named 'discord'

Although, when I run:

>>python 

>>import discord

It works as intended, any suggestions?

like image 396
Lucas Matheus Avatar asked Apr 17 '18 19:04

Lucas Matheus


People also ask

How do I install a discord module?

Windows InstallationOpen Command Prompt by typing cmd into Search. Install discord.py by using: py -3.6 -m pip install -U discord.py[voice] for voice support. py -3.6 -m pip install -U discord.py for without voice support.

Does discord.py support slash commands?

discord.py does not support slash commands and will never add support for slash commands (as it has shut down) thus I recommend disnake (a popular fork).


3 Answers

Go into the terminal and use: pip uninstall discord.py wait a few seconds so it can fully delete it, and then use pip install discord.py. Should work

like image 173
Arin CelMare Avatar answered Oct 20 '22 07:10

Arin CelMare


sudo pip install discord.py solves the problem

like image 1
Senju Avatar answered Oct 20 '22 08:10

Senju


Maybe it's the Python version issue.

When I tried running in python3.8 I got the same error. Switched over to 3.6 and it worked.

like image 1
Peble Jackson Avatar answered Oct 20 '22 07:10

Peble Jackson