-
Install virtualenv
pip install virtualenv
-
I believe in installing virtualenvwrapper as well
pip install virtualenvwrapper
-
Edit your ~/.bash_profile file again
nano ~/.bash_profile
-
Add this line
source /usr/local/bin/virtualenvwrapper_lazy.sh
Save and exit out of nano using control + O, enter, and then control + X.
Here let's crib from NPR Apps How to Setup Your Mac to Develop News Applications Like We Do
virtualenv
creates the actual environment that you’ll be using, whilevirtualwrapper
makes the interface to these virtual environments even simpler.
If you installed virtualenvwrapper:
-
Create a virtualenv to store the codebase
mkvirtualenv name-of-virtualenv
-
Activate the virtualenv
workon name-of-virtualenv
-
Exit out of the virtual environment, run:
deactivate
-
Delete the virtual
rmvirtualenv name-of-virtualenv
If you didn't install virtualenvwrapper:
-
Change into your code directory
cd name-of-directory
-
Create a virtualenv to store the codebase
virtualenv name-of-virtualenv
-
Change into your virtualenv directory
cd name-of-virtualenv
-
Activate the virtualenv
. bin/activate
-
Move back one level to the code directory
cd ..