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:

  1. 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.
  2. Execute the following command on PowerShell:
  3. set-executionpolicy remotesigned
  4. Type A and press Enter like shown below:
  5. 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"):

    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"): A
  6. The error should be fixed now. Try activating the virtual environment now. It should get activated.