我尝试从vscode运行powershell脚本(按F5执行),但失败了,因为终端将python路径和python调试launcer与powershell路径连接在一起。我如何求解,以便在运行Python脚本时采用Python路径,在运行powershell时自动运行powershell
从vscode运行(F5)powershell脚本时,终端将解释以下路径:
PS C:\Users\luuk\Desktop\Scripts\Archive\Archive> & 'C:\Users\luuk\AppData\Local\Programs\Python\Python38\python.exe' 'c:\Users\luuk\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy\launcher' '60329' '--' 'c:\Users\luuk\Desktop\Scripts\Archive\Archive\Powershell\StreamingSQLToPBI.ps1'
我需要更改什么才能使vscode自动检测到Powershell路径
解决方案:要在VSCode中执行PowerShell脚本,除了安装扩展“
PowerShell
”,我们还需要打开终端“PowerShell Integrated Console
”:(F1
,PowerShell: Restart Current Session
),然后选择代码,然后单击F8
在此终端中执行代码产生这些路径的原因是,在VSCode中,当我们单击
F5
调试文件时,默认情况下,VSCode在“Python Debug Console
”中执行。它将指定终端使用的Python解释器和使用的Python扩展(Python扩展提供Python调试功能),以及要执行的脚本的路径相关问题 更多 >
编程相关推荐