ModuleNotFoundError: No module named 'discord'
Woran liegt hier der fehler?:
import discord
from discord.ext import commands
import logging
from dotenv import load_dotenv
import os
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
handler = logging.FileHandler(filename='discord.log', encoding='uft8', mode='w')
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.event
async def on_ready():
print(f"We are ready to go in, {bot.user.name}")
bot.run(token, log_handler=handler, log_level=logging.DEBUG)
Fehlermeldung:
PS C:\Python Discord Bot> & "C:/Python Discord Bot/.venv/Scripts/python.exe" "c:/Python Discord Bot/main.py"
Traceback (most recent call last):
File "c:\Python Discord Bot\main.py", line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
PS C:\Python Discord Bot>

17 Replies
er kann das discord module nicht finden
wie löse ich dies
meinst du mit discord discord.py?
ja
dann mach
import discord.py
anstatt nur discordden findet es auch nicht
hast du es über pip installiert?
und dann ist es
import discord
tatsächlich, my badAnscheinend hat er discord.py nicht installiert
Oder zumindest nicht richtig
führ im terminal mal
pip install -U discord.py
ausahhh jetzt hat es geklappt. danke vielmals. jedoch habe ich nochmals eine frage wenn das euch nichts ausmacht. das dotenv hat auch eine fehlermeldung. muss ich dafür auch noch etwas herunterladen?
PS C:\Python Discord Bot> & "C:/Python Discord Bot/.venv/Scripts/python.exe" "c:/Python Discord Bot/main.py"
Traceback (most recent call last):
File "c:\Python Discord Bot\main.py", line 4, in <module>
from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
PS C:\Python Discord Bot>
pip install python-dotenv
Vielen lieben Danke für die Hilfe @Tyzes :hug:
Gerne dann seine Antwort akzeptieren
idR wenn du einen ModuleNotFoundError bekommst, kannst du den import auf google eingeben und findest da recht schnell, welches modul du installieren musst
als tipp: anstatt discord bots gleich zu programmieren würd ich dir raten die Sprache dahinter etwas mehr zu verstehen anstatt direkt mit ner schweren api zu starten
@CeyMay
:pin: × IST DEIN PROBLEM ERLEDIGT, @CeyMay?
Dein Thread
ModuleNotFoundError: No module named 'discord'
in unserem Coding-Support-System
ist seit einigen Tagen inaktiv - sollte sich das Problem gelöst haben, akzeptiere bitte eine Antwort oder schließe es selbst.
› ✅
- Antwort akzeptiert: Der Ersteller dieser Frage hat deine Antwort akzeptiert (+25 Karma)