0
votes

-bash: /usr/local/bin/python3: No such file or directory 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.

2

2 Answers

0
votes

The error comes from a broken installation of virtualenvwrapper. It seems you've installed virtualenvwrapper using /usr/local/bin/python3 but later removed that python.

The error comes from ~/.bashrc. Edit it, search for something like source virtualenvwrapper_lazy.sh or . virtualenvwrapper.sh and comment out or remove the line.

0
votes
1. Check virtualenvwrapper is installed.
2. Open your .bashrc file.
3. Run the below commands:

export WORKON_HOME=$HOME/.virtualenv

source /usr/local/bin/virtualenvwrapper.sh

workon <virtual_env_name_of_your_choice>

which python

4. Check the python version.
5. If you want to change the python of your virtualenv, then follow the steps below:

vi .bashrc or vi .zshrc

alias python=python3

6. Open a new terminal. 

which python

workon

which python

You are all set with virtualenv set to python3 by default.