Virtualenv Command Not Found

I couldn't get virtualenv to work despite various attempts. I installed virtualenv on MAC OS X using:

pip install virtualenv

and have also added the PATH into my .bash_profile. Every time I try to run the virtualenv command, it returns:

-bash: virtualenv: command not found

Every time I run pip install virtualenv, it returns:

Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

I understand that in mac, the virtualenv should be correctly installed in

/usr/local/bin

The virtualenv is indeed installed in /usr/local/bin, but whenever I try to run the virtualenv command, the command is not found. I've also tried to run the virtualenv command in the directory /usr/local/bin, and it gives me the same result:

-bash: virtualenv: command not found

These are the PATHs I added to my .bash_profile

export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/usr/local/bin/python
export PATH=$PATH:/Library/Framework/Python.framework/Version/2.7/lib/site-packages

Any workarounds for this? Why is this the case?


If you installed it with

pip install virtualenv

You need to run

sudo /usr/bin/easy_install virtualenv

which puts it in /usr/local/bin/.

The above directory by default should be in your PATH; otherwise, edit your .zshrc (or .bashrc) accordingly.


I faced the same issue and this is how I solved it:

  1. The issue occurred to me because I installed virtualenv via pip as a regular user (not root). pip installed the packages into the directory ~/.local/lib/pythonX.X/site-packages
  2. When I ran pip as root or with admin privileges (sudo), it installed packages in /usr/lib/pythonX.X/dist-packages. This path might be different for you.
  3. virtualenv command gets recognized only in the second scenario
  4. So, to solve the issue, do pip uninstall virtualenv and then reinstall it with sudo pip install virtualenv (or install as root)