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

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐