问题比较复杂,尝试以下方案,
(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

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐