I have both python 2.7 and 3.8 and wanted to run virtualenv on 3.8. As the result of which python3
was /usr/local/bin/python3
I did virtualenv -p /usr/local/bin/python3 virEnv
and then source virEnv/bin/activate
to start the virtualenv. Now I switched to another terminal (on visual studio code) and ran workon virEnv
and it gave workon:command not found
. I searched for the solution on stackoverflow and found this thread workon:command not found and did
export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON='/usr/local/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh
But the third line is resulting in
/usr/local/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is
set properly
I want to work on my virtualenv on any terminal by running workon name
. Please help.