用户设置JSON环境变量

时间:2019-05-06 23:14:57

标签: visual-studio-code

我正在使用“同步设置”扩展程序来将我的用户设置同步到Gist,并具有多个与其同步的系统。我的问题是我的系统没有相同的配置,特别是我的用户配置文件的路径不同。

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

是否有一种方法可以跨平台使用?

我想要这样的东西:

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

有可能吗?我已经看到有环境变量,但是我无法找到它们的清单。

1 个答案:

答案 0 :(得分:0)

我只是依靠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"
        }
    ]
相关问题