virtualenv in PowerShell? virtualenv in PowerShell? powershell powershell

virtualenv in PowerShell?


The latest version of virtualenv supports PowerShell out-of-the-box.

Just make sure you run:

Scripts\activate.ps1

instead of

Scripts\activate

The latter will execute activate.bat, which doesn't work on PowerShell.


My original answer is now outdated. Now, just use activate.ps1 (rather than activate.bat) to activate from a Powershell environment.


Original answer:

Here's a post that contains a Powershell script that allows you to run batch files that persistently modify their environment variables. The script propagates any environment variable changes back to the calling PowerShell environment.


A quick work-around would be to invoke cmd and then run your activate.bat from within the cmd session. For example:

PS C:\my_cool_env\Scripts> cmdMicrosoft Windows [Version 6.1.7600]Copyright (c) 2009 Microsoft Corporation.  All rights reserved.C:\my_cool_env\Scripts>activate.bat(my_cool_env) C:\my_cool_env\Scripts>