Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

714
Visualizações
ningún módulo llamado 'dotenv' python 3.8

EDITAR: Resuelto, si alguien se encuentra con este python3.8 -m pip install python-dotenv funcionó para mí.

Intenté reinstalar tanto dotenv como python-dotenv pero sigo recibiendo el mismo error. Tengo el archivo .env en el mismo directorio que este 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)
over 4 years ago · Santiago Trujillo
7 Respostas
Responde à pergunta

0

en su administrador de instalación si es Ubuntu o Debian intente: apt install python3-dotenv

también puede probar sudo pip3 install python-dotenv para instalar a través de pip.

Hagas lo que hagas, recuerda incluir explícitamente las 3 partes que faltan.

Debian/Ubuntu tienen paquetes separados y actualmente python significa python2 y python3 significa python3 en sus repositorios apt. Sin embargo, cuando se trata de su binario de python instalado localmente en su sistema, el binario de python que usa de forma predeterminada puede variar dependiendo de a qué /usr/bin/python esté vinculado en su sistema. Algunos sistemas tienen un enlace simbólico a algo como python2.7 y otros pueden ser algo como python3.5 . Existen problemas similares con pip instalado localmente. Por lo tanto, ¿por qué es importante usar el '3' al instalar o buscar paquetes de python?

over 4 years ago · Santiago Trujillo Relatório

0

Soy nuevo en Python y acabo de recibir exactamente el mismo error. Acabo de cambiar el comando de instalación a lo que usé de un tutorial de MongoDB para instalar PyMongo. Funcionó a las mil maravillas :)

python -m pip install python-dotenv

over 4 years ago · Santiago Trujillo Relatório

0

Esto resolverá simplemente instalando a través de la terminal:

pip3 install python-dotenv para versiones de python 3.0 o pip install python-dotenv para python diferente a 3.0

over 4 years ago · Santiago Trujillo Relatório

0

Si estás usando poetry ( https://python-poetry.org ), entonces...

Asegúrate de estar haciendo:

 $ poetry run SOME_COMMAND # such as `poetry run pytest`

En lugar de solo:

 $ SOME_COMMAND # such as `pytest`

Mi problema (en detalle) era...

 # Starting with a _contrasting_ example that _unexpectedly worked_.. # A long time ago I did.. $ pip install pytest # And now, I was doing everything below.. $ poetry add requests # ..Then I wrote code that has `import requests` in it # ..Then I wrote some unit test code (to use with pytest) to test the use of `requests` # ..And NOT knowing I'm supposed to do `poetry run pytest`, I was just doing $ pytest # ..And it (oddly) worked, perhaps because maybe `requests` had been installed globally somewhere for me. # ..But then I did $ poetry add python-dotenv # ..Then I wrote code that had `from dotenv import load_dotenv` in it # ..Then I wrote some unit test code (to use with pytest) to test the use of `python-dotenv` # And I got the error I should have gotten.. $ pytest # ..a bunch of error output, including.. ModuleNotFoundError: No module named 'dotenv'

Por lo tanto, la solución fue:

 # Get rid of the global pytest. Don't want to use that. # (I think this step is optional, b/c I think `poetry run pytest` below will use the pytest installed via poetry in your virtual env (ie I _think_ it will (on it's own) NOT use the globally installed pytest.)) $ pip uninstall pytest $ poetry add python-dotenv $ poetry add --dev pytest $ poetry run pytest

El crédito por la solución es para:

https://github.com/joeyespo/pytest-watch/issues/112

over 4 years ago · Santiago Trujillo Relatório

0

En mi caso, estaba asignando un alias de python a python3 en mi consola zsh.

Ejecutar un archivo .py con python3 -i filename.py hizo que funcionara.

over 4 years ago · Santiago Trujillo Relatório

0

Tuve el mismo problema porque estaba ejecutando el comando de instalación localmente (en mi entorno virtual).

Al ejecutarlo globalmente (fuera del entorno virtual), finalmente resolvió el problema;)

over 4 years ago · Santiago Trujillo Relatório

0

Tuve el mismo problema (Python 3.8.5, dotenv 0.15.0) y obtuve ModuleNotFoundError: ningún módulo llamado 'dotenv' tanto en la consola como en JupyterLab. Todos los demás paquetes parecían instalarse a través de pip sin problemas.

Acabo de ejecutar:

pip3 desinstalar python-dotenv

pip3 install -U python-dotenv

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda