在vscode中添加conda终端
正常安装了miniconda和vscode后,在vscode中没有conda的terminal配置和终端选项。
从开始菜单找到conda powershell的快捷方式文件,打开其属性,复制目标一栏的内容,分成两段,一段是powershell可执行文件的路径,一段是运行conda配置的参数。填写到vscode的setting.json中,在"terminal.integrated.profiles.windows"新建conda配置项如下,
{
"[python]": {
"editor.formatOnType": true
},
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
},
"Conda": {
"source": "PowerShell",
"path": "${env:windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"args": " -ExecutionPolicy ByPass -NoExit -Command \"& 'C:\\Users\\daye\\miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\Users\\daye\\miniconda3' \"",
}
}
}
第23-27行是新增的内容。