[Python] no module named 'dotenv' python 3.8

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    EDIT: Solved, if anyone comes across this python3.8 -m pip install python-dotenv worked for me.

    I've tried reinstalling both dotenv and python-dotenv but I'm still getting the same error. I do have the .env file in the same directory as this script.

    #bot.py
    import os
    import discord

    from dotenv import load_dotenv
    load_dotenv()


    token=os.getenv('DISCORD_TOKEN')

    client = discord.Client()


    @client.event
    async def on_ready():
    print(f'{client.user} has connected to Discord!')


    client.run(token)

    Continue reading...

Compartilhe esta Página