-1

When i run the code it says:

Traceback (most recent call last): File "C:\Users\Gebruiker\PycharmProjects\pythonProject\DiscordBot.py", line 1, in import discord ModuleNotFoundError: No module named 'discord'

idk how to fix this, please help me.

  • 1
    How did you install the Python discord module? Did you follow the instructions on https://pypi.org/project/discord.py/? – Random Davis Jul 13 '21 at 19:58

1 Answers1

2

You can install discord using:

pip install discord

If you are using anaconda, check your python interpreter from PyCharm. Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters Ensure to select correct version of python.exe

e.g.

  • For bare python (For this you need to install discord ) C:\Users\xxx\AppData\Local\Programs\Python\Python38\Lib (a path similar to this)

  • For anaconda you'll see C:\Users\xxx\AppData\Local\Continuum\anaconda3\python.exe

Select the correct interpreter and you are good to go

In any case, i suggest you to take the time and learn about virtual environment https://docs.python.org/3/library/venv.html

Ermolai
  • 303
  • 4
  • 15