“无法启动 conpty”,但命令提示符已设置为默认配置文件

问题描述 投票:0回答:3

我的组织似乎禁止使用很多东西。尝试在 VSC 中启动 python 脚本返回错误

终端进程启动失败:发生本机异常 启动期间(无法启动 conpty)。

在寻找答案时,我在这个问题中找到了解决方案,其中有人说更改为使用cmd,或者仅使用配置文件。所以我切换到命令提示符作为默认配置文件并且

"terminal.integrated.defaultProfile.windows": "命令提示符"

在 settings.json 中添加,但当我尝试启动 python 脚本时仍然返回相同的错误。

我应该改变什么才能在 VSCode 中自由使用 python? 我可以使用我的用户的 cmd.exe,但没有管理员权限。

visual-studio-code
3个回答
0
投票

我遇到了完全相同的问题,我的解决方案是允许

\\?\C:\Windows\System32\conpty.exe
通过具有无限制级别的软件限制策略。


0
投票

对我来说是

\\?\C:\Windows\System32\conhost.exe

您可以通过打开事件查看器(通过 windows 键搜索)并展开“管理事件摘要”部分中的“警告”部分来找出导致问题的位置。

双击下面以“SoftwareRestric...”开头的那个:

然后查看底部,它标识了位置:

您需要将此添加到您的本地安全策略 > 软件限制策略 > 其他规则


0
投票

在settings.json中更改或dsiable conpty

{
// "terminal.integrated.shell.windows": "C:\Program^ Files\Git\bin\bash.exe",
"terminal.integrated.shell.windows": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe",
"terminal.integrated.windowsEnableConpty": false
}

从这里:https://github.com/microsoft/vscode/issues/88008

© www.soinside.com 2019 - 2024. All rights reserved.