2

I'm trying to get virtualenvwrapper running. I install it with:

sudo pip install virtualenvwrapper

I edited the .bashrc like this:

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh

When I try to run "source ~/.bashrc" I get this error:

/usr/bin/python: 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/bin/python and that PATH is
set properly.

I installed pip, python and virtualenv in the following directories:

which python
/usr/bin/python

which pip
/usr/bin/pip

which virtualenv
/usr/local/bin/virtualenv

What am I doing wrong?

Alex
  • 53
  • 1
  • 5

3 Answers3

5

I think you need to

pip3 install virtualenv virtualenvwrapper

and add this to your ~/.bashrc file

 export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

This is because your virtualenvwrapper is pointing to python3. I just resolved mine now. Thanks to this help

Adeyemi Simeon
  • 140
  • 2
  • 6
1

Your error happens because you installed virtualenv for Python 2.7, but you try use it with Python 3. Use pip3 to install Python 3 packages on multi-version system.

pip uninstall virtualenvwrapper
pip3 install virtualenv virtualenvwrapper
Chen A.
  • 10,140
  • 3
  • 42
  • 61
  • Check the output for `python -v`. That's the default one, which points to `/usr/bin/python`. This error usually indicates version conflicts. If it says 2.7, then use pip install for both virtualenv and virtualenvwrapper modules. Else use pip3 to install both. – Chen A. Nov 23 '17 at 15:59
  • 1
    @ChenA. To check for python version, instead of small "v", it should be capital "V": `python -V` – Eje Aug 21 '18 at 10:28
1

You need to source /usr/local/bin/virtualenvwrapper.sh in your .bashrc (you don't need to export it).

thebjorn
  • 26,297
  • 11
  • 96
  • 138