Workaround for virtualenvwrapper for windows postactivate script

Virtualenvwrapper’s windows port (virtualenvwrapper-win) helps to manage your venvs on windows platform, yet it is not so straigtforward about using hooks like postactivate. That is what official documentation has to say about this:

Hooks

To run some commands after mkvirtualenv you can use hooks. First you need to define VIRTUALENVWRAPPER_HOOK_DIR variable. If it is set mkvirtualenv will run postmkvirtualenv.bat script from that directory. Version 1.2.0 (16-03-2015)

I tried to set VIRTUALENVWRAPPER_HOOK_DIR and place postactivate.bat there, but it didnt work out. The workaround I found for emulating postactivate behaviour is to edit postactivate.bat which is located in %WORKON_HOME%\<VENV_NAME>\Scripts

Roman Dodin

Network engineer at Nokia
Eagerness to learn multiplied by passion to share.
You can reach me at LinkedIn

You Might Also Like