Experiencing this error when you try to execute commands inside your Python virtual environment?
ModuleNotFoundError: No module named '<name of module>'
I encountered it a while ago.
The reason might be because you transfered your virtual environment folder to another location (or you copied it from another computer, like in my case).
This is how to fix it:
Open the /Scripts/activate
file inside your virtual environment folder.
#43
):
VIRTUAL_ENV="$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u 'Z:\<your NEW folder>'; else echo '/Z/<your NEW folder>'; fi;)"
Change the path to the new location of your virtual environment.
Change it from
Z:\<your OLD folder>
and /Z/<your OLD folder>
to
Z:\<your NEW folder>
and /Z/<your NEW folder>
/Scripts/activate.bat
. (line #2
in my case)
set "VIRTUAL_ENV=Z:\<folder>"