为什么 Visual Studio Code 打开第二个 Python 终端并且破坏了第一个?

huangapple go评论58阅读模式
英文:

Why opens Visual Studio Code a second Python terminal and breaks the first?

问题

自今早开始,我的Visual Studio Code(在Macbook Pro,M1芯片上)表现得相当突然不同。

如果我现在逐行运行Python脚本中的代码在Python终端中(见附带的GIF):

  1. 会打开一个新的终端窗口。在这个终端中,Visual Studio Code正确启动了我首选的Python(3.10.9(conda))分发版本。
  2. 然而,它很快中断了这个终端进程并打开了一个新的。在这第二个实例中,Python没有被启动,而是将Python命令发送到这个新终端,这显然会产生错误。
  3. 然后,如果我在第二个终端中手动启动Python,我可以继续执行脚本。

为什么会发生这种情况?我应该怎么做才能使它恢复到以前的状态,即只打开一个终端...

值得一提的是,我在这里分享我的terminal.integrated.profile.osx配置。

英文:

Since this morning, my Visual Studio Code (on Macbook Pro, M1-chip) rather brusquely started behaving differently.

If I now run code from a Python script line by line in the Python terminal (see attached gif):

  1. a new terminal window opens. In this terminal Visual Studio Code correctly launches my preferred Python (3.10.9 (conda)) distribution.
  2. Yet, it then quickly breaks this terminal process and opens a new one. In this second instance, Python is not launched, but the Python commands are sent to this new terminal, which self-evidently produces an error.
  3. Then, if I launch Python in my second terminal manually, I can continue with the script.

Why does this happen? And what can I do to get it back to how it always has been? Just one terminal that opens...

For what it's worth, I am sharing here my terminal.integrated.profile.osx

{
"terminal.integrated.inheritEnv": false,
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.automationProfile.osx": {},
"terminal.integrated.profiles.osx": {
    
    "bash": {
        "path": "bash",
        "args": [
            "-l"
        ],
        "icon": "terminal-bash"
    },
    "zsh": {
        "path": "zsh",
        "args": [
            "-l"
        ]
    },
    "fish": {
        "path": "fish",
        "args": [
            "-l"
        ]
    },
    "tmux": {
        "path": "tmux",
        "icon": "terminal-tmux"
    },
    "pwsh": {
        "path": "pwsh",
        "icon": "terminal-powershell"
    }
}

}

Hope you can help me out为什么 Visual Studio Code 打开第二个 Python 终端并且破坏了第一个?

答案1

得分: 1

@starball的答案是解决方法。
这个问题昨天在这里提出:

https://stackoverflow.com/a/76453447/11107541

解决方法是将Visual Studio Code中的Python扩展降级到v.2023.8.0。

英文:

So @starball 's answer was the fix.
This issue was raised Yesterday here:

https://stackoverflow.com/a/76453447/11107541

The fix is downgrading the Python extension in Visual Studio Code to v.2023.8.0

huangapple
  • 本文由 发表于 2023年6月13日 03:11:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459654.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定