I just set up a little script so that I can activate a particular  
virtualenv and easily exit it.  Basically it just invokes a new bash  
subshell and sets the PATH to include the current bin dir:

[EMAIL PROTECTED]:~/python-envs/trac$ cat activate
bash --init-file .bash_init
[EMAIL PROTECTED]:~/python-envs/trac$ cat .bash_init
. ~/.bash_profile
export PATH="`pwd`/bin:$PATH"

So running ./activate will set up your path in the subshell, and  
exiting will restore your normal PATH.  I don't really like running  
~/.bash_profile again b/c I actually end up with it re-adding some  
stuff that's already in the PATH, but otherwise I lost my normal  
prompt coloring.  Someone with more bash-fu know how to fix that?

[EMAIL PROTECTED]:~/python-envs/trac$ which python
/usr/local/bin/python
[EMAIL PROTECTED]:~/python-envs/trac$ ./activate
[EMAIL PROTECTED]:~/python-envs/trac$ which python
/home/mgood/python-envs/trac/bin/python
[EMAIL PROTECTED]:~/python-envs/trac$ exit
[EMAIL PROTECTED]:~/python-envs/trac$ which python
/usr/local/bin/python

-- Matt
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to