Im having trouble getting python-decouple to work

3k Views Asked by At
   pip install python-decouple   
   from decouple import config
   
   ModuleNotFoundError: No module named 'decouple'    

  

   print(API_USERNAME=config('first_name'))

keep getting this error even after i installed it correctly, and i uninstalled "decoupler" as well. I also tried installing it with conda still the same issue i honestly stuck

python --version

3.9.7

python -m pip install decouple

Doesnt work

Installed Pythons found by py Launcher for Windows
 -3.10-64 *
 -3.9-64



from decouple import config
ImportError: cannot import name 'config' from 'decouple' (C:\ProgramData\Anaconda3\lib\site-packages\decouple\__init__.py)
2

There are 2 best solutions below

4
Ivan Kwong On

Try this:

virtualenv venv
.\venv\Scripts\activate
pip install python-decouple
1
GODMAN On

if you are using vscode and a virtual environment try to enter ctrl + shift + p and select python intepreter then click on Enter interpreter path now go to you virtual environment file and navigate to scripts go to right click on python.exe select copy path and past as interpreter path