python virtual environment

Activate.ps1 cannot be loaded because running scripts is disabled on this system

We encountered with this error “Activate.ps1 cannot be loaded because running scripts is disabled on this system” while activating the Python virtual environment in Windows system. The solution is quite simple and reason of this error is due to the Windows Execution policy.

In our system, the error was like this. In the below section, you will also find the reference of Execution Policies.

PS C:\Users\Sharad\Python_Projects> .\practice_env\Scripts\Activate.ps1
.\practice_env\Scripts\Activate.ps1 : File C:\Users\Sharad\Python_Projects\practice_env\Scripts\Activate.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\practice_env\Scripts\Activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\Sharad\Python_Projects>

Solution
To solve this error, simply run this command in your Powershell terminal.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Now try to activate the Python virtual environment, problem should be solved now.

Given below is the screenshot for the reference.
python virtual environment execution policy


Posted

in

by

Tags:

Comments

One response to “Activate.ps1 cannot be loaded because running scripts is disabled on this system”

  1. Eyenine Avatar
    Eyenine

    Thank you so much brother.IT helps me a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: