The deactivate command provided by virtualenvwrapper is actually a shell function, similar to workon . If you have a virtual env active, you can list the names of these functions with typeset -F .
To use them in a script, they need to be defined there, because shell functions do not extend to child shells.
To define these functions, send a virtualenvwrapper.sh script to the shell of the script where you are going to call these functions, for example:
source $(which virtualenvwrapper.sh)
This allows you to call these functions in your shell script, as you would in a shell:
deactivate
Update: What I described works for other functions provided by virtualenvwrapper (e.g. workon ). I incorrectly assumed that this would work for deactivation, but this is a more complicated case, because it is a function that will be defined only in the shell in which workon or activate were executed.
source share