Do you see mkvirtualenv command not found error even after installing virtualenvwrapper ? This post explains how to properly install virtualenvwrapper. I recently had to install virtualenv and virtualenvwrapper on one of my production servers. While setting up my server I came through this strange error:

mkvirtualenv: command not found

mkvirtualenv-command-not-found

I was confused as I just installed virtualenv and virtualenvwrapper and the shell would still not recognize the mkvirtualenv command. I researched a bit and found that I needed to define the path to virtualenvwrapper in my “.bashrc” so that the shell knows where the virtualenvwrapper.sh bash script resides. So I went and located where where virtualenvwrapper.sh script was. I found that the default path where virtualenvwrapper is installed is:

So to resolve the “mkvirtualenv command not found error”, There are two simple steps that you need follow after the “pip install virtualenvwrapper” command.

1. First create a directory where all your virtual environments will reside. I chose to put them in “~/.environments”, but you can put them anywhere that you like really. Feel free to create a directory wherever you’d like your environments to reside.

2. Now open up your “~/.bashrc” or “~/.profile” file and add the following to the end of the file.

mkvirtualenv-command-not-found

3. Finally we need to inform the bash about the changes we just made. So you can either use the following command OR just simply close the shell and re-open it.

Running the above command will re-load the .bashrc configuration in laymen terms :). Now you can just type in the command mkvirtualenv in the shell and you should see something like the following.

mkvirtualenv-command-not-found

 

mkvirtualenv command not found is now resolved and you can create your new virtual environment using the command mkvirtualenv.