virtualenv and Django on a Mac

Information on this page is quite outdated. In 2019 use pyenv or pipenv.

 

I work on OS X Lion. Up until recently, I just used “pip install stuff” and it all worked fine. I could even make Django projects use different versions of Django just by coping another version in project root.

I didn’t like it. it was all in one place, cluttered and though I didn’t run into problems, I had a feeling there is one just around the corner.

Enter virtualenv!

So, to cut the story short, here are a link worth checking:
http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/
I followed steps 1-4 almost to the letter, and I can verify it works juist fine šŸ™‚

I havent tried theĀ Qt Console, but I recommend IPython and (required) readline. The two together make auto-completing in Django shell a pleasure to use. IPython is pip-installable, and readline should be easy-installed, not pip-installed (something about whichĀ packagesĀ load first).

Also, the “Dynamic object information” feature is awsome:

 

 

UPDATE:

Update to Mountain Lion broke the virtualenvs, but the recovery was easy, as described here:
http://www.jongales.com/blog/2012/07/25/fixing-virtualenv-after-installing-mountain-lion/

basically, this:

  1. Installed theĀ XCode 4.4 Command Line Tools.
  2. Re-installed pip: sudo easy_install pip
  3. Re-installed virtualenv and virtualenvwrapper: sudo pip install virtualenv virtualenvwrapper