Skip to main content

Python Virtual Env - VS Code - .venv Terminal "Activate.ps1 cannot be loaded"

 This is caused by execution policy of PowerShell.


We can fix it by adding "-ExecutionPolicy Bypass" in settings.json.

Ctrl + Shift + P > type settings.json > Add the below lines

"terminal.integrated.profiles.windows": {
  "PowerShell": {
    "source": "PowerShell",
    "icon": "terminal-powershell",
    "args": ["-ExecutionPolicy", "Bypass"]
  }
},
"terminal.integrated.defaultProfile.windows": "PowerShell",

Restart VS Code

https://stackoverflow.com/questions/56199111/visual-studio-code-cmd-error-cannot-be-loaded-because-running-scripts-is-disabl/67420296#67420296