PyCharm running Python file always opens a new console(PyCharm 运行 Python 文件总是打开一个新的控制台)
问题描述
我最初开始在 Spyder 中学习 Python,但最近决定切换到 PyCharm,因此我正在以类似 Spyder 的心态学习 PyCharm.
I initially started learning Python in Spyder, but decided to switch to PyCharm recently, hence I'm learning PyCharm with a Spyder-like mentality.
我有兴趣在 Python 控制台中运行一个文件,但是每次我重新运行这个文件时,它都会在新打开的 Python 控制台下运行.这可能会在一段时间后变得烦人,因为将打开多个 Python 控制台,它们基本上都做同样的事情,但略有不同.
I'm interested in running a file in the Python console, but every time I rerun this file, it will run under a newly opened Python console. This can become annoying after a while, as there will be multiple Python consoles open which basically all do the same thing but with slight variations.
我希望只有一个 Python 控制台并在该控制台中运行整个文件.有人知道如何改变吗?也许我使用的心态不是很 PyCharmic?
I would prefer to just have one single Python console and run an entire file within that single console. Would anybody know how to change this? Perhaps the mindset I'm using isn't very PyCharmic?
推荐答案
在 PyCharm 2018.2+ 中有一个特定的选项:Settings |构建、执行、部署 |控制台 |将现有控制台用于使用 Python 控制台运行".
There is a specific option in PyCharm 2018.2+: Settings | Build, Execution, Deployment | Console | Use existing console for "Run with Python console".
使用 Python 控制台运行 是您在运行配置中启用的选项.如果您在脚本执行后不需要 Python 控制台,请禁用它:
Run with Python console is an option you have enabled in the Run Configuration. Disable it if you don't need a Python console after a script execution:
这篇关于PyCharm 运行 Python 文件总是打开一个新的控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PyCharm 运行 Python 文件总是打开一个新的控制台


- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01