【问题标题】:How to use a remote python interpreter in remote development - ssh in VSCode如何在远程开发中使用远程python解释器——VSCode中的ssh
【发布时间】:2019-05-03 18:09:41
【问题描述】:

Microsoft 最近发布了对 SSH 的远程开发支持。

https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh

但是,在 python 中,如果单击“选择 python 解释器”。可供选择的解释器仅适用于 anaconda 中的一组 python 解释器。

可供选择的解释器位于:

~/anaconda3/*
/usr/bin/python

我在自定义位置有一个自定义 python 解释器。我的翻译在~/projects/myproject/bin/python

我们如何通过给它一个路径来配置一个远程python解释器?

注意:我已经配置了setting.json

"python.pythonPath": "${workspaceFolder}/bin/python",

但它似乎并不尊重它

【问题讨论】:

    标签: visual-studio-code vscode-remote


    【解决方案1】:

    设法让它工作

    1. 更新 vscode

    2. 我的文件:

    # settings.json
    {
      "python.pythonPath": "/custom/bin/python"
    }
    
    # launch.json
    "configurations": [
      {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "pythonPath": "${config:python.pythonPath}"
      },
    ...
    
    1. 重启 vscode

    2. F1 -> 选择解释器

    【讨论】:

      猜你喜欢
      • 2019-04-18
      • 2014-10-20
      • 1970-01-01
      • 2019-12-08
      • 2021-04-18
      • 1970-01-01
      • 2022-10-18
      • 2019-11-21
      • 1970-01-01
      相关资源
      最近更新 更多