繁体   English   中英

如何在 VS 代码中配置 launch.json 以在 Windows 中接受网络路径(python)

[英]how to configure the launch.json in VS code to accept a network path (python) in windows

我已获得python exe 的以下网络路径(在windows10中):

\\eu\tac\conda\1.0\win\envs\dev\CURRENT\python.exe

请注意上述路径中的单引号和双\

我尝试在vscode 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: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        },
        {
            "name": "Python: network (not working)",
            "type": "python",
            "request": "launch",
            "program": "\\eu\\tac\\conda\\1.0\\win\\envs\\dev\\CURRENT\\python.exe",
            "console": "integratedTerminal",
            "justMyCode": true

        }
    ]
}

但是,我不断收到错误,或者是指无效语法,这些语法可能来自我尝试过的\/变体。 No such file or directory: 'H:\\eu\\tac\\conda\\1.0\\win\\envs\\dev\\CURRENT\\python.exe'错误消息,因为终端添加了H:在节目之前。

所以问题是,我怎样才能让vscode正确识别路径?

所以我发现launch.json中的"program": "${file}"实际上是指要运行的文件而不是可执行文件路径。

default interpreter pathconda path (用于 conda)下的设置中选择 python 可执行文件。

通过将上述两个参数更改为 exe 文件名(在这种情况下) \\eu\tac\conda\1.0\win\envs\dev\CURRENT\python.exe似乎将vscode指向正确的 python exe。

为清楚起见,是一张关于地点和方式的图片: 在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM