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.
Thank you so much brother.IT helps me a lot.