【问题标题】:Using visual studio code without access to powershell在不访问 powershell 的情况下使用 Visual Studio 代码
【发布时间】:2021-09-05 09:32:16
【问题描述】:

我安装了 Visual Studio 代码并下载了 python 扩展,当尝试执行代码时,我收到一个错误:

The terminal process failed to launch: A native exception occurred during launch 
   (File not found: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)

我不是这台笔记本电脑的管理员,因为这是办公室笔记本电脑,并且无法访问 powershell,由于政策,我也无法获得访问权限。请建议我可以做些什么作为补救措施——我之前只对 python 使用过 IDLE。如何运行代码?

【问题讨论】:

标签: python windows powershell visual-studio-code


【解决方案1】:

您可以尝试在 settings.json 文件中添加这个:

  "terminal.integrated.defaultProfile.windows": "Command Prompt",
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
      "path": ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"]
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    }
  },

如果你的cmd也被禁止了,你可以尝试下载Code Runner扩展来执行代码。

【讨论】:

    【解决方案2】:

    您可以更改您的 VScode 终端默认配置文件

    选择默认配置文件

    然后从powershell换成cmd

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-28
      • 1970-01-01
      • 2017-01-31
      • 2020-09-22
      • 1970-01-01
      • 2012-04-13
      • 1970-01-01
      相关资源
      最近更新 更多