I created a virtual environment in python, now while activating the same from my command line in vscode I am getting the error
PS C:\Users\hpoddar\Desktop\WebDev\ReactComplete\DjangoReact\ArticlesApp\APIProject> ..\venv\scripts\activate
..\venv\scripts\activate : File C:\Users\hpoddar\Desktop\WebDev\ReactComplete\DjangoReact\ArticlesApp\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 my project structure

However if I activate the same from my command line, it works without any error.
Python version : 3.9.2

A way is changing the terminal in VSCode to Command Prompt instead of PowerShell.
Open the drop-down on the right of the terminal and choose Select Default Profile

Select Command Prompt from the options.

Or, you can also set the execution policy to RemoteSigned or Unrestricted in PowerShell
Note: This only affects the current user
Open PowerShell
Run the following command: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser OR Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
(Remove -Scope CurrentUser to apply to all users)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With