Python Virtualenv - No module named virtualenvwrapper.hook_loader Python Virtualenv - No module named virtualenvwrapper.hook_loader python python

Python Virtualenv - No module named virtualenvwrapper.hook_loader


The issue was solved following the steps below:

#switch the /usr/bin/python link to point to current python linkcd /usr/binsudo mv python python.baksudo ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/python python

Re-arrange the export command in order that it is placed before the virtualenv commands in my .bash_profile file:

PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATHexport PATH# needed for virtualenvwrapperexport WORKON_HOME=$HOME/.virtualenvssource /usr/local/bin/virtualenvwrapper.sh

Re-Install setuptools, easy install and PIP. This is obviously needed in order that they work properly with the new python version:

sudo sh setuptools-0.6c11-py2.7.eggsudo easy_install-2.7 pippip install virtualenv


Also, if you have macports, make sure /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin is listed before /Library/Frameworks/Python.framework/Versions/2.7/bin and /usr/local/bin in PATH. Then set the following in you .profile:

export VIRTUALENVWRAPPER_PYTHON=`which python`export VIRTUALENVWRAPPER_VIRTUALENV=`which virtualenv`source `which virtualenvwrapper.sh`


For anyone using Ubuntu 18.04 and Python 3+, this did the trick for me:

which python3 # outputs /usr/bin/python3 export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3  source `which virtualenvwrapper.sh`