-1

I have an error when running one of my projects, and it is very strange. What happens is this:

 File "src/run.py", line 4, in <module>
from dotenv import load_dotenv, find_dotenv
ImportError: No module named dotenv

The strange thing is that I have installed python-dotenv. This is the fourth line:

from dotenv import load_dotenv, find_dotenv

Does anyone know how to fix this? Running High Sierra with python 2.7.

Ben Aepli
  • 11
  • 3

1 Answers1

0

It sounds you have have installed dotenv for another python distribution.

You can try to run the two following commands that use the same python program to install and run python-dotenv. The first one installs python-dotenv with pip. The second one tests the install. I use sudo to install it with main python program.

sudo python -m pip install python-dotenv
python -c 'from dotenv import load_dotenv, find_dotenv'

It works also with Python3 (where you do not have to run the install command with sudo)

python3 -m pip install python-dotenv
python3 -c 'from dotenv import load_dotenv, find_dotenv'
Guillaume Jacquenot
  • 11,217
  • 6
  • 43
  • 49