I'm a big fan of using
virtualenvwrapper) where possible. It allows you to cleanly manage multiple python environments. I also occasionally use CodeRunner on Mac to test, debug and run standalone scripts. It wasn't immediately clear to me how to make CodeRunner run inside one of my virtualenvs, so this might be useful for someone attempting something similar.
First, make sure you have a clean virtual environment for CodeRunner set up (I use
$ mkvirtualenv --no-site-packages --python=python2.7 coderunner
Now open CodeRunner and go to File > Preferences in the menu, hit the Languages tab and select Python on the left hand side.
You need to first enable the Language uses compilation script box:
then click Edit Script ... which will open a new file. This is the compilation script that is run before the actual command seen in the Run Command input in the preferences. Here we will make the complication script return the path to activate our virtualenv:
and back in the CodeRunner preferences pane, add (as seen in the above screenshot):
source $compiler; python $filename;
This is a quick and dirty way to get up and running. You could make a bit more of a sophisticated script that used some custom parameters, but I think this does the job.