【问题标题】:User Settings JSON Environment Variables用户设置 JSON 环境变量
【发布时间】:2019-05-06 23:14:57
【问题描述】:

我正在使用同步设置扩展将我的用户设置同步到一个 Gist 并有多个系统从它同步。我的问题是我的系统没有相同的配置,特别是我的用户配置文件是不同的路径。

我想在安装在我的用户空间中的 Python 解释器的路径中使用环境变量。

有没有一种跨平台的方法?

我想要这样的东西:

"python.pythonPath": "${env:HOME}\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe"

这可能吗?我已经看到有环境变量,但我无法找到它们的列表。

【问题讨论】:

标签: visual-studio-code


【解决方案1】:

我只是依靠 Path 环境变量来处理它,就像在这篇文章中一样:How to setup Visual Studio code to find Python 3 interpreter in Windows 10

"python.pythonPath": "python.exe"

另外,我使用的是 Shell Launcher,所以除了 Windows PowerShell 和 PowerShell Core 之外,我还为 Python 添加了一个条目:

"shellLauncher.shells.windows": [
        {
            "shell": "c:\\Program Files\\PowerShell\\6\\pwsh.exe",
            "label": "PowerShell Core"
        },
        {
            "shell": "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
            "label": "Windows PowerShell"
        },
        {
            "shell": "python.exe",
            "label": "Python 3.7"
        }
    ]

【讨论】:

    猜你喜欢
    • 2022-10-06
    • 2018-07-13
    • 2014-12-17
    • 1970-01-01
    • 2016-07-29
    • 1970-01-01
    • 2014-09-24
    • 1970-01-01
    • 2016-02-03
    相关资源
    最近更新 更多