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>
No description
17 Replies
Tyzes
Tyzes6mo ago
er kann das discord module nicht finden
CeyMay
CeyMayOP6mo ago
wie löse ich dies
Tyzes
Tyzes6mo ago
meinst du mit discord discord.py?
CeyMay
CeyMayOP6mo ago
ja
Tyzes
Tyzes6mo ago
dann mach import discord.py anstatt nur discord
CeyMay
CeyMayOP6mo ago
den findet es auch nicht
Tyzes
Tyzes6mo ago
hast du es über pip installiert? und dann ist es import discord tatsächlich, my bad
Raku | Felix 🐊
Anscheinend hat er discord.py nicht installiert Oder zumindest nicht richtig
Tyzes
Tyzes6mo ago
führ im terminal mal pip install -U discord.py aus
CeyMay
CeyMayOP6mo ago
ahhh 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>
Tyzes
Tyzes6mo ago
pip install python-dotenv
CeyMay
CeyMayOP6mo ago
Vielen lieben Danke für die Hilfe @Tyzes :hug:
Raku | Felix 🐊
Gerne dann seine Antwort akzeptieren
Laqco
Laqco6mo ago
idR wenn du einen ModuleNotFoundError bekommst, kannst du den import auf google eingeben und findest da recht schnell, welches modul du installieren musst
𝔗i𝔯i
𝔗i𝔯i6mo ago
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
Raku | Felix 🐊
@CeyMay
Bl4cklist🔥System
: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)

Did you find this page helpful?