Pycharm中用run with Python console调试脚本

时间:2024-03-24 22:54:27

Pycharm中用run with Python console调试脚本

有时,我们需要在Pycharm下像IDLE那样在shell下的调试脚本。我们可以设置run with Python console实现上述目的

1.脚本的Run菜单,选择‘’编辑配置‘,这个配置是per script的。
Pycharm中用run with Python console调试脚本
2.勾选Run with Python Console
Pycharm中用run with Python console调试脚本
3.执行脚本,可以看到现在脚本在Python Console中运行而不是一般情况的Run下运行了,现在我们就可以像IDLE一样,很直接在Console输入命令,查看变量的值,方便地进行代码调试了。
Pycharm中用run with Python console调试脚本