[英]Using visual studio code without access to powershell
我安裝了 visual studio 代碼並下載了 python 擴展,當我嘗試執行代碼時,我得到一個錯誤:
The terminal process failed to launch: A native exception occurred during launch
(File not found: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
我不是這台筆記本電腦的管理員,因為這是辦公室筆記本電腦並且無權訪問 powershell,也不會根據政策獲得訪問權限。 請建議我可以做些什么作為補救措施——我之前只使用 IDLE python。如何運行代碼?
您可以嘗試在 settings.json 文件中添加:
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"path": ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"]
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
}
},
如果你的cmd也被禁止,你可以嘗試下載Code Runner
Extension來執行代碼。
我的 Visual Studio 代碼有問題,它不允許我打開終端,它給了我一個錯誤“終端進程無法啟動:啟動期間發生本機異常(找不到文件:C:\Windows\System32\ WindowsPowerShell\v1.0\powershell.exe)”。 我通過安裝 Code Runner Extension 解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.