vscode 如何默认打开anaconda powershell terminal

2024 年更新:

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

  1. ctrl+shift+p打开palette面板
  2. 输入 select interpreter选择你想要的环境
  3. 左下角就能看到当前环境的信息

过期

  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' "]
}

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

###2022年更新

{
    "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": [
        "."
    ]
}
  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
根据引用\[1\]中的内容,打开Anaconda Powershell Prompt的快捷键是通过在运行窗口中输入"regedit"打开注册表编辑器,然后在路径"计算机\HKEY_CLASSES_ROOT\Directory\Background\shell"下创建一个名为"Anaconda"的项,然后在该项下创建一个名为"command"的子项,并将其默认值设置为"powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& ‘C:\Users\yuanjing\miniconda3\shell\condabin\conda-hook.ps1’ ;conda activate ‘C:\Users\yuanjing\miniconda3’ ""。请注意,其中的路径"C:\Users\yuanjing\miniconda3"需要根据你自己安装的Anaconda的路径进行更改。 #### 引用[.reference_title] - *1* [win10安装miniconda3后右键打开Anaconda Powershell Prompt](https://blog.csdn.net/weixin_42538829/article/details/115618086)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [【学习笔记】python安装和调用总结](https://blog.csdn.net/qq_45659165/article/details/125487136)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值