Visual Studio 代码升级到 1.56.0...Windows 环境问题
Visual Studio Code Upgrading to 1.56.0... Issues with Windows Environment
在上次 Visual Studio 代码更新之前,我能够设置 windows 环境变量。
现在有了新的更新,我不能也不知道该怎么办。
我的代码很长,所以为了简化它,我尝试更改 windows 提示,一些简单的东西,看看我是否能找到解决方案。
{
"folders": [],
"settings": {
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
},
"Command Prompt": {
"source": "Command Prompt",
"path": [
"${env:windir}\Sysnative\cmd.exe",
"${env:windir}\System32\cmd.exe"
],
"args": [],
"icon": "star",
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.env.windows": {
"ENV_PROMPT":"(env_qgis)",
"PROMPT": "(Entorno Qgis) $P$G"
},
"terminal.integrated.defaultProfile.windows": "Command Prompt"
}
}
预期结果是:
解决方案在这个 link:
https://code.visualstudio.com/docs/editor/integrated-terminal
在这一段中解决方案:
终端配置文件
终端的 shell 在 Linux 上默认为 $SHELL,在 Windows 上默认为 macOS 和 PowerShell。终端配置文件可用于通过 运行 终端配置默认或次要 shells:Select 默认配置文件命令,也可通过终端的下拉菜单访问。
VS Code 会自动为下拉列表显示一组常用配置文件,还会检测不太常见的配置文件,这些配置文件只会在选择默认配置文件时显示。
注意:在工作区范围内设置时,一些终端设置不会自动运行,您必须通过将 terminal.integrated.allowWorkspaceConfiguration 设置为 true 来授予它们对 运行 的权限您的用户设置。
我所做的是,转到配置,转到用户配置,然后我写:
"terminal.integrated.allowWorkspaceConfiguration":真
{
"terminal.integrated.shell.windows": "C:\WINDOWS\System32\cmd.exe",
"python.languageServer": "Pylance",
"workbench.activityBar.visible": true,
"window.zoomLevel": -1,
"terminal.integrated.tabs.enabled": true,
"terminal.integrated.allowWorkspaceConfiguration":true
}
现在我的代码又可以工作了:
{
"folders": [
{
"name": "Program",
"path": ".."
},
],
"settings": {
"python.autoComplete.extraPaths": ["C:/Roberto/Visual_Studio_Code/GisBike/programa;C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"],
"python.pythonPath": "C:\OSGeo4W64\apps\Python37\python.exe",
//"python.pythonPath": "C:\Users\Fcc\Desktop\vs_qs.bat",
//"python.pythonPath": "C:\Program Files\QGIS 3.12\apps\Python37\python.exe",
"editor.fontSize": 18,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 60,
"terminal.integrated.env.windows": {
// GDAL
"GDAL_DATA": "C:\OSGeo4W64\share\gdal",
"GDAL_DRIVER_PATH": "C:\OSGeo4W64\bin\gdalplugins",
"GDAL_FILENAME_IS_UTF8": "YES",
// GeoTIFF
"GEOTIFF_CSV": "C:\OSGeo4W64\share\epsg_csv",
// Qt
"O4W_QT_BINARIES": "C:/OSGeo4W64/apps/Qt5/bin",
"O4W_QT_DOC": "C:/OSGeo4W64/apps/Qt5/doc",
"O4W_QT_HEADERS": "C:/OSGeo4W64/apps/Qt5/include",
"O4W_QT_LIBRARIES": "C:/OSGeo4W64/apps/Qt5/lib",
"O4W_QT_PLUGINS": "C:/OSGeo4W64/apps/Qt5/plugins",
"O4W_QT_PREFIX": "C:/OSGeo4W64/apps/Qt5",
"O4W_QT_TRANSLATIONS": "C:/OSGeo4W64/apps/Qt5/translationss",
"QT_PLUGIN_PATH": "C:\OSGeo4W64\apps\qgis\qtplugins;C:\OSGeo4W64\apps\qt5\plugins",
"PROJ_LIB":"C:\OSGeo4W64\share\proj",
// QGIS
"OSGEO4W_ROOT": "C:\OSGeo4W64",
"QGIS_PREFIX_PATH": "C:/OSGeo4W64/apps/qgis",
// Cache
"VSI_CACHE": "TRUE",
"VSI_CACHE_SIZE": "1000000",
"JPEGMEM":"1000000",
// Virtual Envoirment
"VIRTUAL_ENV": "C:\Program Files\Python38\env_qgis",
"ENV_PROMPT":"(env_qgis)",
"PROMPT": "(Entorno Qgis) $P$G",
// Path
"PATH": "C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts;C:\OSGeo4W64\apps\qt5\bin;C:\OSGeo4W64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem;C:\Users\Fcc\AppData\Roaming\Python\Python37\Scripts;C:\Program Files\Exiftool;C:\Program Files\ffmpeg\bin",
// Python
"PYTHONHOME": "C:\OSGeo4W64\apps\Python37",
"PYTHONPATH":"C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"
},
"git.ignoreLimitWarning": true,
"terminal.integrated.cwd": "C:\Roberto\Visual_Studio_Code\GisBike\programa",
"editor.minimap.enabled": false,
"python.analysis.extraPaths": [
"C:/Roberto/Visual_Studio_Code/GisBike/programa;C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"
]
},
"emmet.extensionsPath": "",
"terminal.integrated.automationShell.windows": "cmd",
}
在上次 Visual Studio 代码更新之前,我能够设置 windows 环境变量。 现在有了新的更新,我不能也不知道该怎么办。
我的代码很长,所以为了简化它,我尝试更改 windows 提示,一些简单的东西,看看我是否能找到解决方案。
{
"folders": [],
"settings": {
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
},
"Command Prompt": {
"source": "Command Prompt",
"path": [
"${env:windir}\Sysnative\cmd.exe",
"${env:windir}\System32\cmd.exe"
],
"args": [],
"icon": "star",
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.env.windows": {
"ENV_PROMPT":"(env_qgis)",
"PROMPT": "(Entorno Qgis) $P$G"
},
"terminal.integrated.defaultProfile.windows": "Command Prompt"
}
}
预期结果是:
解决方案在这个 link:
https://code.visualstudio.com/docs/editor/integrated-terminal
在这一段中解决方案:
终端配置文件
终端的 shell 在 Linux 上默认为 $SHELL,在 Windows 上默认为 macOS 和 PowerShell。终端配置文件可用于通过 运行 终端配置默认或次要 shells:Select 默认配置文件命令,也可通过终端的下拉菜单访问。
VS Code 会自动为下拉列表显示一组常用配置文件,还会检测不太常见的配置文件,这些配置文件只会在选择默认配置文件时显示。
注意:在工作区范围内设置时,一些终端设置不会自动运行,您必须通过将 terminal.integrated.allowWorkspaceConfiguration 设置为 true 来授予它们对 运行 的权限您的用户设置。
我所做的是,转到配置,转到用户配置,然后我写:
"terminal.integrated.allowWorkspaceConfiguration":真
{
"terminal.integrated.shell.windows": "C:\WINDOWS\System32\cmd.exe",
"python.languageServer": "Pylance",
"workbench.activityBar.visible": true,
"window.zoomLevel": -1,
"terminal.integrated.tabs.enabled": true,
"terminal.integrated.allowWorkspaceConfiguration":true
}
现在我的代码又可以工作了:
{
"folders": [
{
"name": "Program",
"path": ".."
},
],
"settings": {
"python.autoComplete.extraPaths": ["C:/Roberto/Visual_Studio_Code/GisBike/programa;C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"],
"python.pythonPath": "C:\OSGeo4W64\apps\Python37\python.exe",
//"python.pythonPath": "C:\Users\Fcc\Desktop\vs_qs.bat",
//"python.pythonPath": "C:\Program Files\QGIS 3.12\apps\Python37\python.exe",
"editor.fontSize": 18,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 60,
"terminal.integrated.env.windows": {
// GDAL
"GDAL_DATA": "C:\OSGeo4W64\share\gdal",
"GDAL_DRIVER_PATH": "C:\OSGeo4W64\bin\gdalplugins",
"GDAL_FILENAME_IS_UTF8": "YES",
// GeoTIFF
"GEOTIFF_CSV": "C:\OSGeo4W64\share\epsg_csv",
// Qt
"O4W_QT_BINARIES": "C:/OSGeo4W64/apps/Qt5/bin",
"O4W_QT_DOC": "C:/OSGeo4W64/apps/Qt5/doc",
"O4W_QT_HEADERS": "C:/OSGeo4W64/apps/Qt5/include",
"O4W_QT_LIBRARIES": "C:/OSGeo4W64/apps/Qt5/lib",
"O4W_QT_PLUGINS": "C:/OSGeo4W64/apps/Qt5/plugins",
"O4W_QT_PREFIX": "C:/OSGeo4W64/apps/Qt5",
"O4W_QT_TRANSLATIONS": "C:/OSGeo4W64/apps/Qt5/translationss",
"QT_PLUGIN_PATH": "C:\OSGeo4W64\apps\qgis\qtplugins;C:\OSGeo4W64\apps\qt5\plugins",
"PROJ_LIB":"C:\OSGeo4W64\share\proj",
// QGIS
"OSGEO4W_ROOT": "C:\OSGeo4W64",
"QGIS_PREFIX_PATH": "C:/OSGeo4W64/apps/qgis",
// Cache
"VSI_CACHE": "TRUE",
"VSI_CACHE_SIZE": "1000000",
"JPEGMEM":"1000000",
// Virtual Envoirment
"VIRTUAL_ENV": "C:\Program Files\Python38\env_qgis",
"ENV_PROMPT":"(env_qgis)",
"PROMPT": "(Entorno Qgis) $P$G",
// Path
"PATH": "C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts;C:\OSGeo4W64\apps\qt5\bin;C:\OSGeo4W64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem;C:\Users\Fcc\AppData\Roaming\Python\Python37\Scripts;C:\Program Files\Exiftool;C:\Program Files\ffmpeg\bin",
// Python
"PYTHONHOME": "C:\OSGeo4W64\apps\Python37",
"PYTHONPATH":"C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"
},
"git.ignoreLimitWarning": true,
"terminal.integrated.cwd": "C:\Roberto\Visual_Studio_Code\GisBike\programa",
"editor.minimap.enabled": false,
"python.analysis.extraPaths": [
"C:/Roberto/Visual_Studio_Code/GisBike/programa;C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"
]
},
"emmet.extensionsPath": "",
"terminal.integrated.automationShell.windows": "cmd",
}