英文:
Why opens Visual Studio Code a second Python terminal and breaks the first?
问题
自今早开始,我的Visual Studio Code(在Macbook Pro,M1芯片上)表现得相当突然不同。
如果我现在逐行运行Python脚本中的代码在Python终端中(见附带的GIF):
- 会打开一个新的终端窗口。在这个终端中,Visual Studio Code正确启动了我首选的Python(3.10.9(conda))分发版本。
- 然而,它很快中断了这个终端进程并打开了一个新的。在这第二个实例中,Python没有被启动,而是将Python命令发送到这个新终端,这显然会产生错误。
- 然后,如果我在第二个终端中手动启动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):
- a new terminal window opens. In this terminal Visual Studio Code correctly launches my preferred Python (3.10.9 (conda)) distribution.
- 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.
- 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
答案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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论