One line fix for virtual environment not executing in windows PowerShell (activate file cannot be loaded because running scripts is disabled in this system)

The problem:

  • Whenever I create a virtual environment and try to activate in my windows machine, it throwed the following error:
  • It says that “activate file cannot be loaded because running scripts is disabled in this system”
  • This is because the script as has an undefined Execution Policy

The solution:

  • In order to fix this, we have to set the execution policy to unrestricted.
  • Open the PowerShell and execute the following line:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  • Running this one liner, can fix the problem, hope this helps!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashwin B

I love the internet, technology and building beautiful things