mkvirtualenv: command not found mkvirtualenv: command not found bash bash

mkvirtualenv: command not found


I added the following in my .bashrc, referring this

export PATH=/usr/local/bin:$PATHsource /usr/local/bin/virtualenvwrapper.sh

Now mkvirtualenv works-

pkoli@pkoli-SVE15136CNB:~/Desktop$ mkvirtualenv BUGSUsing base prefix '/usr'New python executable in BUGS/bin/python3Also creating executable in BUGS/bin/pythonInstalling setuptools, pip...done.


I ran into the same problem and I fixed it with by following the tutorial:

http://exponential.io/blog/2015/02/10/install-virtualenv-and-virtualenvwrapper-on-ubuntu/

Part 1: Install the required packages

sudo apt-get install python-pip python-dev build-essential

sudo pip install virtualenv virtualenvwrapper

sudo pip install --upgrade pip

Part 2: Setup virtualenvwrapper in ~/.bashrc.

I used vim to edit ~/.bashrc.

Firstly, install vim with the command:

sudo apt-get install vim

Secondly, edit ~/.bashrc

vi .bashrc

enter [Shift] + [g] //G (shift + g): to go the end of the file

enter [a] //Type a to edit the file

Then insert three lines:

export WORKON_HOME=~/virtualenvs

export VIRTUALENVWRAPPER_PYTHON=[link-to-python-folder]

source /usr/local/bin/virtualenvwrapper.sh

where [link-to-python-folder] can be, for example:

  • if you are using python 3,

export VIRTUALENVWRAPPER_PYTHON=/user/bin/python3

  • if you are using python 2,

export VIRTUALENVWRAPPER_PYTHON=/user/bin/python

Next,enter [Esc] then :wq

The Esc key means return the command line, :wq means save the changes and exit vi.

Part 3: Enable the virtual environment.

source ~/.bashrc

mkdir -p $WORKON_HOME

Now, you can try again with mkvirtualenv:

mkvirtualenv your_project

  • To enable the 'your_project' virtual environment:

    workon your_project

  • To exit it:

    deactivate

I noticed that when I installed separately virtualenv and virtualenvwrapper (with two times of 'sudo pip install'), I failed when run source ~/.bashrc because of a failure of the importing the module virtualenvwrapper.hook_loader, so although you really installed virtualenv and virtualenvwrapper, let try it one more time with sudo pip install virtualenv virtualenvwrapper.

Hope you find it useful!


export WORKON_HOME=~/Virtualenvsexport PROJECT_HOME=~/Develexport VIRTUALENVWRAPPER_PYTHON=/usr/bin/pythonsource /usr/local/bin/virtualenvwrapper.sh

If you have a clean installation of virtualenv and virtualenvwrapper, then this should work in mac OS. It did for me.