I have seen this question about 5 times before, I have tried every solution there, I have tried uninstalling python-dotenv, reinstalling it, using pip, pip3, using pip3 -m install..., I don't have "dotenv" (the one without python) by itself, I'm not using a virtual environment, i've tried switching to one and installing it but it still says that there is not module named "dotenv". I've also tried sudo pip3 install python-dotenv, yet I still face the same problem. Can someone help me please?
As you can see, when I try to use dotenv it doesn't work. I'm using flask if anyone wants to know.
Based on the information you provide, please refer to the following:
The location where the module is installed is not the python environment used by the current VS Code terminal.
Please use the command "
python --version
" or "pip --version
" to check whether the environment used by the VS Code terminal is the same as the one displayed in the lower left corner of VS Code:(If their results are not the same, please use the shortcut key Ctrl+Shift+` to open a new VS Code terminal, and it will automatically enter the selected environment. If they are still different, please put the required python first in the python environment variable outside VS Code, and then reopen VS Code. )
Please find the location of the module installation package (
\lib\site-packages\
), then move out or delete the folder "dotenv", and then reinstall the module.Check the installation of the module: (
pip show python-dotenv
)Run:
Reference: Python environments in VS Code.