将visualstudio代码配置为在Windows上的bash中运行Python

2024-06-25 23:57:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用WindowsBash控制台在VisualStudio代码中运行python.py文件。

我想做的是:

更改settings.json中的默认shell:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
}

tasks.json中添加任务以运行以文件名为参数的python命令:

^{pr2}$

这里有几个问题需要解决:

  1. 任务没有按我的要求在bash中运行
  2. 使用文件路径中的/mnt/c访问C驱动器I need to replaceC:\

你能谈谈我对这些问题的解决办法吗?在


Tags: 文件代码pybashjsonsettingswindowsshell