This file will modify your existing cd command to detect whether the new pwd is a child directory within a Python virtualenv directory. If so, it will activate the enivornment, switching the paths for python, pip, and easy_install, similar to how RVM works with .rvmrc files. This project was inspired by this blog post: http://thadeusb.com/weblog/2011/8/17/manage_python_virtualenv.
-
cat virtualenv_cd_alias >> ~/.bash_aliases
-
In ~/.bashrc, add:
source ~/.bash_aliases
-
In ~/.bash_profile, add:
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
-
Restart your bash shell.
-
cd /path/to/your/virtualenv/