You’ll find a bunch of different approaches to this on Google; Using an iPython boot script that extends sys.path with paths from the current virtualenv. Or calling the iPython script with the virtualenv’s python binary (python `which ipython`).
They all tend to be problematic; for example, the latter doesn’t work if the virtualenv has been configured with –no-site-packages.
Why not simply install iPython inside the virtualenv proper? This is what I’ve been doing for a while, reluctantly, and I’m finally aware of what has bothered me about it: iPython clocks in at an insane 8.3 megabyte (the uncompressed size is 18 MB, about 15 of which is documentation). On my slow DSL connection the download takes a good minute.
Using virtualenvwrapper, I’ve now added this to my postmkvirtualenv script:
mkdir -p "$CACHE"
$VIRTUAL_ENV/bin/pip install --download-cache="$CACHE" ipython
This gives me iPython in every new virtual environment, at the cost of 2 or 3 seconds installation time.