模型部署01 vscode 环境配置c++ python

准备工作:英伟达GPU+Linux+VScode

                1.     本地访问:

                        远程访问:ssh协议;在vscode上-插件--ms-vscode-remote.remote-ssh--安装

                2. c++开发:安装插件:ms-vscode.cpptools

                3. python插件: ms-python.python

                4. 代码补全(收费,选装): TabNine .tabnine-vscode    GitHub.copilot        

                5. connect to host -- ssh **@****

                6. 在远程安装上述内容

 测试python :

打开终端

mkdir  /test/course_1
cd /test/course_1
touch demo.py

输入内容

sum =0
for i in range(5):
    sum+= i

print(sum)

 (先自行创建一个conda环境)

conda env list
conda activate name
python demo.py

调试:

 创建launch.json 文件

输入内容:

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name":"Python",
            "type":"python",
            "request": "launch",
            "program": "${file}",
            "console":"integratedTerminal",
            "justMyCode":false

        }
    ]
}

 即可调试。

测试c++:

touch main.cpp

输入内容:

#include <iostream>
using namespace std;

int main(){
    int sum{0};
    for (int i{0}; i<5 ;i++)
        sum +=i;

    cout << sum <<endl;
    return 0;


}
g++ main.cpp -o main
./main

 配置tasks.json:

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++ 生成活动文件",
			"command": "/usr/bin/g++",
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"-Wall",
				"-std=c++14",
				"${file}",
				// "${fileDirname}/*.cpp"
				"-o",
				"${workspaceFolder}/release/${fileBasenameNoExtension}"

			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group":{ 
				"kind":"build",
				"isDefault":true
			},
			"detail": "编译器: /usr/bin/g++"
		}
	]
}
./release/main

调试:

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/release/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ 生成活动文件"

        },
        {
            "name":"Python",
            "type":"python",
            "request": "launch",
            "program": "${file}",
            "console":"integratedTerminal",
            "justMyCode":false

        }
    ]
}

  • 7
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值