Cannot activate venv because computer is not allowed to run scripts
Problem: Unable to activate virtual environment due to script execution restrictions.
Solution:
Open PowerShell as administrator
Press Win + X
and select Windows PowerShell (Admin) or search for PowerShell,
right-click, and choose Run as Administrator.
Set the Execution Policy
Run the following command in the PowerShell window:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Confirm the Change
Hit Enter. When prompted, type A
to allow all scripts and press Enter again to confirm the change.
Reopen Your Code Editor
Close and reopen your code editor (VS Code, for example). After doing this, you should now be able to activate the virtual environment without any issues.