Hi fellow pythonistas, there seems to be a problem when virtualenv is used in PowerShell.
When I try to activate my environment in PowerShell like..
> env
try this:
. .\env\Scripts\activate.ps1
watch dots and spaces
Just run first
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
and then
./env/Scripts/activate.sp1
That's all
This error happens due to a security measure which won't let scripts be executed on your system without you having approved of it. You can do so by opening up a powershell with administrative rights (search for powershell in the main menu and select Run as administrator from the context menu) and entering:
set-executionpolicy remotesigned
for more: http://www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/
On Windows PowerShell, I have to type from the venv/Scripts folder :
. ./activate
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.
Inside of the Scripts directory of your virtual environments folder there are several activation scripts that can be used depending on where you are executing the command. If you are trying to activate your virtual env from the Windows PowerShell, try using the following command:
. .\env\Scripts\activate.ps1
In the event you receive an error about the activation script being disabled on your system, you will first need to invoke an execution policy change on your system. This will need to be done as the administrator.
To do this:
1) Right click on the PowerShell application and select Run as Administrator
2) Run the following command: Set-ExecutionPolicy Unrestricted
3) Rerun the activation command: . .\env\Scripts\activate.ps1