我想.py
使用 Windows bash 控制台在 Visual Studio Code 中运行 python 文件。
我试图做的事情:
更改默认外壳settings.json
:
{
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
}
将任务添加到以文件名作为参数tasks.json
运行命令:python
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "python",
"isShellCommand": true,
"showOutput": "always",
"tasks": [
{
"taskName": "Run python in bash",
"suppressTaskName": true,
"args": ["${file}"]
}
]
}
这里有几个问题需要解决:
- 任务没有按照我的意愿在 bash 中运行
- 要访问
C
驱动器,我需要 在文件路径中C:\
替换/mnt/c
你能分享我对这些问题的解决方案吗?