Fixing - Running Scripts is Disabled on this System Error on Windows
You may run into this error when you try to activate the virtual environment on Windows command Prompt or PowerShell.
On Windows 10, the script execution policy is restricted by default due to which a script cannot be executed on Window command Prompt or Powershell.
To fix this error, do the following:
- Search for Powershell on Windows Start Menu (may not work on Windows Prompt), then right-click on it and choose to run it as administrator from the drop-down menu.
- Execute the following command on PowerShell:
- Type A and press Enter like shown below:
- The error should be fixed now. Try activating the virtual environment now. It should get activated.
set-executionpolicy remotesigned
After running the above command, you will see something like the following:
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A