Gaurav Wadhwani
Gaurav Wadhwani

Reputation: 1352

Virtualenv installation on OS X

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

Upvotes: 1

Views: 424

Answers (1)

jjstopforth
jjstopforth

Reputation: 36

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!

Upvotes: 2

Related Questions