vscode的launch:program ‘‘ does not exist


如图

一般是由于launch.json文件没有配置好的缘故。在右下角的ADD configuration如选第二个登录:

看到program这一栏,这一栏很重要,一般是选择你CMakelist,编译出来的可执行文件

看我CMakelist,

我生成的可执行文件是test_,所以路径可以这样输入:

我在之前cmake的时候已经有了test_这个文件了

然后就可以运行/start debugging了,比如我的程序如下(F5调试,shift停止)

简单一点的launch.json配置

Test.py测试文件名字。

import numpy as np
import cv2

FilePath = './Luffy.jpeg'
## Read image
img = cv2.imread(FilePath,0)
## show your image
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

launch.json配置,新建的时候debug configuration的是python file。改成"program": "${file}",则可以直接F5运行当前文件。

{
    // 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: Current File",
            "type": "python",
            "request": "launch",
            "program": "./test.py",
            // "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM