VSCode 运行终端报错:\Scripts\Activate.ps1,因为在此系统上禁止运行脚本...


0x00 问题描述

Windows7 系统环境,Vscode 运行终端的时候报错:

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS D:\my_python_small_projects\movieland> & D:/python_virtualenv/my_flask/Scripts/Activate.ps1
& : 无法加载文件 D:\python_virtualenv\my_flask\Scripts\Activate.ps1,因为在此系统上禁止运行脚本。有关详细信息  
,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。

...

0x01 解决办法

  1. win+r,输入powershell,打开powershell终端
  2. powershell终端输入
set-ExecutionPolicy RemoteSigned

按y

0x02 参考文章

https://blog.csdn.net/weixin_42639633/article/details/113029095