You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何退出PyCharm的‘run file in console’模式以重新运行代码?

How to Exit PyCharm's "Run File in Console" Mode & Re-run Your Code

Hey there! I’ve been stuck in this exact situation before—it’s so frustrating when you can’t re-run your code because the console’s locked into that "Run File in Console" state. Let’s fix this step by step:

  • Stop the active console session first
    Look at the top-right corner of your console panel (like in your screenshot) and click the red square stop button (⏹️). This will terminate the current running session, and the console should jump back to a normal >>> prompt. You should be able to re-run your code right after this.

  • If stopping doesn’t work, restart the Python Console
    If the console still won’t let you re-run code, head to the top-left of the console panel where it says "Python Console". Click the dropdown menu next to it and select Restart Python Console. This will fully reset the console environment, wiping the previous "Run File" state entirely.

  • Pro tip for next time
    Instead of using "Run File in Console", try using the regular green triangle "Run" button (▶️) for your script. This launches a dedicated run window instead of hijacking the Python console, so you won’t run into this lock-up issue again.

内容的提问来源于stack exchange,提问作者Heisenberg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:40:04