Activating virtual environment throws error in powershell

Viewed 2516

I am using Windows PowerShell. But, I don't know why, when I try to activate a python virtual environment, I get this error:

venv\Scripts\activate : File C:\Users\Dell\Desktop\flask\microblog\venv\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
+ venv\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

This is the command I ran:

venv\Scripts\activate

This is the first time it has happened. What is the problem?

1 Answers

Looks like running powershell scripts is disabled on your machine. you can run as admin:

Set-ExecutionPolicy RemoteSigned

or

Set-ExecutionPolicy Unrestricted

this should solve the problem

Related