Visual Studio Code——python程序软件配置

1. 选择虚拟环境

ctrl+shift+p-----> >Python: Select Interpreter

2. 设置Configuration

在Run--->Add Configuration 添加configuration,内容为:

{
    // 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:evaluate_ndf",
            "type": "python",
            "request": "launch",
            "cwd":"/home/Documents/ndf_robot/src/ndf_robot/eval",
            "program": "evaluate_ndf.py",
            "console": "integratedTerminal",
            "justMyCode": false,
            "args": [        
                "--demo_exp", "grasp_rim_hang_handle_gaussian_precise_w_shelf",
                "--object_class", "mug",
                "--opt_iterations", "500",
                "--only_test_ids",
                "--rand_mesh_scale",
                "--model_path", "multi_category_weights",
                "--save_vis_per_model",
                "--config", "eval_mug_gen",
                "--exp", "test_mug_eval",
                "--pybullet_viz"],
            "env":{"CUDA_VISIBLE_DEVICES":"0,1,2,3"}
        }
    ]
}


{
    // 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": "python",
            "request": "launch",
            "program": "/home/dl/anaconda3/lib/python3.7/site-packages/torch/distributed/launch.py",//可执行文件路径
            "console": "integratedTerminal",
            "args": [
                "--nproc_per_node=1",
                "tools/train.py",
                "--model",
                "bisenetv1",
            ],
            "env": {"CUDA_VISIBLE_DEVICES":"0"},
        }
    ]
}

3. 若用ssh远程连接服务器,先进行如下步骤(或者只进行红色字体的部分也可以):

安装Remote-ssh插件

在这里插入图片描述

 本地生成秘钥对并授权

打开PowerShell,输入以下命令生成秘钥:

ssh-keygen -t rsa -b 4096 -f C:\Users\xxxx\.ssh\id_rsa-remote-ssh

执行以下命令将公钥拷贝至远端服务器:

ssh-copy-id -i "C:/Users/xxxx/.ssh/id_rsa-remote-ssh.pub" -p 32768 root@172.10.0.3

如果在PowerShell中无法执行ssh-copy_id命令,可在git的bash中执行。

 配置Remote-SSH插件
在visual studio code界面按下快捷键Ctrl + Shift + p,选择Remote-SSH:connect to host... >Configure SSH Hosts... > C:\User\xxx\.ssh\config进入配置文件中,在文件中添加以下配置信息:
 

Host subscribe-dev
    HostName 10.168.11.11
    User root
    Port 32768
    IdentityFile C:\DevEnv\conf\ssh\id_rsa-remote-ssh

Host:在vscode中显示的远程连接名称。
HostName:远端开发环境主机ip地址。
User:登入用户名。
Port:ssh服务端口号。
IdentityFile:本地秘钥文件路径。

配置完成后就可以在vscode的远程资源管理器中看到这台新添加的远程主机。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值