1

I am trying to install virtualenv on my Mac running OS X Mavericks. To install virtualenv, I used pip

pip install virtualenv

Now when I try to use it, I get the message saying -bash: virtualenv: command not found

Also, an attempt to reinstall gets me this:

Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Cleaning up...

My path and python path variable in the file ~/.bash_profile are set to:

export PATH = /usr/local/bin:$PATH
export PYTHONPATH=/usr/local/lib/python2.7/site-packages
Gaurav Wadhwani
  • 1,352
  • 2
  • 15
  • 32

1 Answers1

2

To re-install virtualenv you will first have to uninstall the current version through pip by using the command:

$ pip uninstall virtualenv

From here, it is not all too important that virtualenv is installed under /usr/local/lib/python2.7/site-packages. For example, doing a quick $ which virtualenv shows me that I have mine under:

/Library/Frameworks/Python.framework/Versions/3.3/bin/virtualenv

and I just use $ virtualenv --python=python_version environment_name to select which python version the environment runs.

So, after uninstalling run $ pip install virtualenv again and then check where it is installed using $ which virtualenv

After that you should just be able to create and run your virtual environments straight away using:

Create:

$ virtualenv evnironment_name

Run:

$ source ./environment_name/bin/activate

or cd to the environment directory first and then $ source bin/activate

To exit the environment just run $ deactivate

I hope this helped!

  • Uninstalling & reinstalling results in the same issue as mentioned in the question - command not found. – Gaurav Wadhwani Oct 18 '14 at 17:58
  • @Guarav Just to double check, have you tried the re-install using sudo? If that and a [relaunch of finder](http://stackoverflow.com/questions/16168754/virtualenv-in-mac-osx-bash-command-not-found-issue)/restart of your machine doesn't work I'm out of my depth :( I hope someone else has the correct answer you need – jjstopforth Oct 18 '14 at 18:19
  • Yep, tried installing sudo and restarted the mac. :( – Gaurav Wadhwani Oct 18 '14 at 18:26