问题比较复杂,尝试以下方案,
(1)这个错误是由配置引起的,关闭vscode,
ctrl+H
显示配置文件,在/home/user/.config下,删除这个文件夹(里面包含错误的配置),
/home/user/.config/code
然后就可以正常配置vscode了。
(2)在launch.json中直接添加路径,

{
    // 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": "${file}",
            "console": "integratedTerminal",
            "python": "/home/user/anaconda3/envs/torch/bin/python",
            "justMyCode": false
        }
    ]
}

(3) 修改inheritEnv设置
vscode有时会提示这么个东东,
在这里插入图片描述
在GUI中配置,
在这里插入图片描述
或者,在settings.json中配置
“terminal.integrated.inheritEnv”: false,

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐