1

when I try importing load_dotenv from dotenv I get the error ModuleNotFoundError: No module named 'dotenv'

Tho I already installed dotenv with py -m pip install python-dotenv

If I try running that command again I simply get Requirement already satisfied: python-dotenv in c:\users\[my name]\appdata\local\programs\python\python310\lib\site-packages (0.19.2)

So it should be installed, shouldn't it? Have no idea what could be the issue here.

SvenTUM
  • 784
  • 1
  • 6
  • 16
  • Can you check where it is installed it may possible it is installed outside of your virtual env. Try these steps to see if it helps : pip uninstall dotenv pip uninstall python-dotenv pip install python-dotenv – Developer Jan 16 '22 at 01:04
  • The Python interpreter you used to run your app/script should be the same Python interpreter where you installed your package. If you used `py -m pip install` to install dotenv, then use the same `py` to run your app. If you run your app inside a virtual env, then you need to install the package inside the same virtual env. – Gino Mempin Jan 16 '22 at 01:05
  • Does this answer your question? [Dealing with multiple Python versions and PIP?](https://stackoverflow.com/questions/2812520/dealing-with-multiple-python-versions-and-pip) – Gino Mempin Jan 16 '22 at 01:06
  • I literally had this problem for multiple hours and managed to fix it five minutes after posting this, tho I don't really know how. I saw an unrelated post discussing something with the Anaconda Prompt so I just decided to try and install it there again. I ran ``` pip install python-dotenv[cli]``` in the powershell prompt and my problem got fixed. Can someone explain what happened? Still new to programming – thebruhmoment Jan 16 '22 at 01:07

0 Answers0