[Solved] Error when vscode activates Python virtual environment

After executing Python – M venv myvenv to create a python virtual environment, the following error is reported when executing the script

The file D:\Tools\Python37\Scripts\Activate.ps1 could not be loaded, because running scripts is disabled on this system.

The reason is that windows prohibits unsigned scripts from running. You can solve this problem by executing the command set executionpolicy remotesigned in PowerShell.


Read More: