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?
Set-ExecutionPolicy. There are 3 scopes; more specific ones have higher precedence:-Scope LocalMachine(requires admin rights),-Scope CurrentUser, or-Scope Process(current process only). The PowerShell CLI accepts a process-specific-ExecutionPolicy <policy>too . Execution policies can also be set via GPO, in which case they cannot be changed or overridden withSet-ExecutionPolicyor via the CLI.