vscode调试和运行相关配置记录

vscode相关记录

vscode常用的一些配置记录笔记,方便后续忘记查看。

1、launch.json

(1)记录1:

// An highlighted block
{
    "version": "1.90.2",
    "configurations": [

        {
            "name": "Python: Train with Args",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": [
                "--save_fig", 
            ],
            "env": {
                "PYTHONUNBUFFERED": "1"
            },
            "cwd":"${fileDirname}",
        }
    ]
}

(2)记录2:

下面展示一些 记录2配置

// An highlighted block
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "env": {"PYTHONPATH":"${workspaceRoot}/yolov10"},
            "envFile": "${workspaceRoot}/.env",
            "console" : "integratedTerminal",
            "stopOnEntry": false
            },
        ],
        // "tasks": [
        // {
        //     "label": "Change Directory",
        //     "type": "shell",
        //     // "command": "cd e:\\2_code\\PythonTraining9\\yolov10\\yolov10",
        //     "command": "cd ${fileDirname}",
        //     "options": {
        //         "cwd": "${workspaceFolder}"
        //     }
        // }
}

2、vscode相对路径相关问题

路径问题
python自带的run和code runner路径配置,使用对应文件路径作为执行参考路径。Debug相对路径设置,需参考配置的cwd键值,分别有 f i l e D i r n a m e 和 {fileDirname}和 fileDirname{workspaceFolder}。

3、vscode常用变量

记录1:
常用vscode变量
记录2:
配置
在这里插入图片描述
记录3:对比总结
在这里插入图片描述
以下是一些常用的 VSCode 变量:
${workspaceFolder}: 当前工作区的根文件夹路径。
${file}: 当前打开文件的完整路径。
${fileDirname}: 当前打开文件所在目录的路径。
${fileBasename}: 当前打开文件的基本名称(包含扩展名)。 ${fileBasenameNoExtension}: 当前打开文件的基本名称(不包含扩展名)。
${fileExtname}: 当前打开文件的扩展名。
${relativeFile}: 当前打开文件相对于工作区根目录的路径。 ${workspaceFolderBasename}: 当前工作区根文件夹的名称。
(个人观点)vscode带name的均为名称;若name前面加了dir,其余带file的也为路径。

4、python虚拟环境设置

新安装的python环境:
python -m venv xxx
进入xxx环境-scripts-Scripts-activate

source xxx-bin-activate

conda环境:
conda create -n xxx python==xxx
conda activate xxx

5、git学习

git chechout main
git merge --no-ff beta
git config merge.ff no
git config --global merge.ff no

git分支详解(约10分钟掌握分支80%操作)
https://www.bilibili.com/video/BV16M411z7uH/?spm_id_from=333.337.search-card.all.click&vd_source=8d7b08caa2ce5bc9e61e3d1e486ddca5
Git分支与合并
https://www.bilibili.com/video/BV1rC411V7uJ/?p=22&spm_id_from=pageDriver

git config --global core.editor ‘vim’
https://blog.csdn.net/CGS_______/article/details/118725372

参考链接:1、Anaconda-- conda 创建、激活、退出、删除虚拟环境
https://blog.csdn.net/hejp_123/article/details/92151293
2、Visual Studio Code 配置Shell环境(第1次更新:20230416)
https://blog.csdn.net/jangboyang222/article/details/130179148
3、VSCode: Windows 下配置 VSCode运行shell
https://www.cnblogs.com/yongdaimi/p/15247771.html
4、vscode 提交git一直卡着转圈圈
https://blog.csdn.net/lsfhack/article/details/131113277
5、解决Python项目Debug过程中文件找不到、参数交互等问题
https://www.bilibili.com/video/BV1i4421Z7aM/?spm_id_from=333.1007.tianma.2-2-5.click&vd_source=8d7b08caa2ce5bc9e61e3d1e486ddca5
6、【研1基本功 别人不教的,那就我来】SSH+Git+Gitee+Vscode 学会了就是代码管理大师
https://www.bilibili.com/video/BV1Fw4m1C7Tq/?spm_id_from=333.880.my_history.page.click&vd_source=8d7b08caa2ce5bc9e61e3d1e486ddca5

  • 16
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值