visual-studio-code - 如何在 Visual Studio Code 的 launch.json 中使用 IDE 变量
问题描述
我为我的 python 项目使用虚拟环境,我想配置命令以自动化调试。
到目前为止,我已经更改了python.pythonPath
inlaunch.json
并且我的意图是在使用自定义任务构建之前更新所有依赖项,其结构如下
{
"version": "2.0.0",
"tasks": [{
"label": "echotest",
"command": "python ...", // Could be any other shell command
"args": ["test"],
"type": "shell"
}]
}
所以,我的问题是,是否有任何方法可以使用键内pythonPath
定义的变量launch.json
command
解决方案
我的问题在这里得到回答,以防它帮助任何人。我的决赛tasks.json
是
{
"version": "2.0.0",
"tasks": [{
"label": "update dependencies",
"command": "${workspaceFolder}\\${config:python.pythonPath} -m pip -r ${workspaceFolder}\\requirements.txt",
"args": [],
"type": "shell"
}]
}
注意文件夹名称中的空格,因为使用它们\"
根本不起作用
推荐阅读
- batch-file - 批处理脚本将文本添加到文件中
- heapsort - 堆排序中的插入和删除
- java - 由于响应内容类型无效,Rest Template 交换失败
- reactjs - TypeScript Redux AnyAction 不接受 extraProps
- javascript - 为什么浏览器在需要的文本之前返回 undefined?
- matlab - Matlab 2016b:确定表达式的未分配符号函数
- prometheus - 如何使用 Prometheus 编写简单的 Pulsar 指标查询?
- mongodb - VPC peering下如何从外部连接到MongoDB Atlas?
- telegram-bot - 后台连续访问用户的实时位置
- docker - 如何检查两个容器是否正确链接?