Last Updated: February 25, 2016
· tijs
Starbird crop2

Simple way to set virtualenv prompt prefix

This is one of these things your bound to only find out after seeing someone else use it, so in case you haven't seen this little trick yet let me show you.

If your like me you probably use virtualenv for all of your projects and since you have a lot of them you always name the virtualenv directory env, ve, venv or something like that. This works fine but when working on more than one project it becomes hard to tell which virtualenv is currently active since your prompt will always look like this:

(venv) $

Not very helpful.. Luckily the fix is is a simple parameter to the virtualenv command! When creating your new virtualenv you simply do:

$ virtualenv --prompt="(project)" venv

And now instead of the name of your virtual env dir your prompt prefix will have your project name when activated!

(project) $
Say Thanks
Filed Under