vscode 如何默认打开anaconda powershell terminal

2024 年更新:

最新的vscode 默认是支持自动切换环境了。就是前面没有(base) 表示环境也是切换好的,微软会弹窗告知你这点

  1. ctrl+shift+p打开palette面板
  2. 输入 select interpreter选择你想要的环境
  3. 左下角就能看到当前环境的信息
{
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },

        "JavaScript Debug Terminal": null,
        
        // "JavaScript Debug Terminal": {
        //     "extensionIdentifier": "ms-vscode.js-debug",
        //     "icon": "debug",
        //     "id": "extension.js-debug.debugTerminal",
        //     "title": "JavaScript Debug Terminal"
        // }
        "conda powershell terminal":{
            "source": "PowerShell",
            "args":"-ExecutionPolicy ByPass -NoExit -Command & 'D:\\ProgramData\\Miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'D:\\ProgramData\\Miniconda3' ", 
            "title":"conda powershell terminal",
        }
    },
    "terminal.integrated.defaultProfile.windows": "conda powershell terminal",
    "python.terminal.activateEnvironment": true,
    "python.pythonPath": "D:\\project\\cryptocurrency\\.env\\python.exe",
    
    // 设置测试框架
    "python.testing.autoTestDiscoverOnSaveEnabled": true,
    "python.testing.nosetestsEnabled": false,
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    // 设置日志格式
    // "python.testing.pytestArgs": ["--log-format='%(asctime)s %(levelname)s %(message)s' ","--log-date-format='%Y-%m-%d %H:%M:%S'"],
    "python.testing.pytestArgs": [
        "."
    ]
}

2022 已过期

  1. ctrl+shift+p打开palette面板
  2. 搜索open user setting(JSON)
  3. 打开setting文件,添加下面代码
{
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.shellArgs.windows":[ "-ExecutionPolicy" ,"ByPass", "-NoExit", "-Command","& 'C:\\ProgramData\\Anaconda3\\shell\\condabin\\conda-hook.ps1'; conda activate 'C:\\ProgramData\\Anaconda3' "]
}

详细参数请参考安装环境下的快捷键文件。
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值