http://stackoverflow.com/questions/11963019/running-python-script-from-inside-virtualenv-bin-is-not-working
Or another option is to simply create a tiny bash wrapper that calls your original pythons script, which will allow you to leave your original script with a generic she-bang..
So if myscript.py is:
#!/usr/bin/env python
...
Then you can make a
myscript
:#!/bin/bash
/Users/foo/environments/project/env/bin/python myscript.py
When you do
myscript
, it will explicitly call your python script with the interpreter you set up.If you have to pass args to the lower level script:
#!/bin/bash
echo $@
/Users/foo/environments/project/env/bin/python myscript.py $@