Search code examples
pythonpython-2.7pip

Error "virtualenv : command not found" but install location is in PYTHONPATH


This has been driving me crazy for the past 2 days. I installed virtualenv on my Macbook using pip install virtualenv. But when I try to create a new virtualenv using virtualenv venv, I get the error saying "virtualenv : command not found".

I used pip show virtualenv and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.

Any ideas what might be going wrong here?


Solution

  • The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.

    I have custom python installed and maybe that's why the default approach doesn't work for me.