Interacting with program after execution

2019-01-09 01:20发布

In PyCharm, after I run a script it automatically kills it:

C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py

Process finished with exit code 0

How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the

>>>

prompt after the script runs once through?

  • PyCharm Community Edition 3.0
  • Windows 7
  • Python 2.7

3条回答
叛逆
2楼-- · 2019-01-09 01:47

Click Run -> Edit Configurations...,

Then check the box Run with Python console.

查看更多
时光不老,我们不散
3楼-- · 2019-01-09 01:49

UPDATE
Starting with version 4.0 there's an option Show command line afterwards when editing run/debug configuration in Run|Edit Configurations....


From output of python --help:

-i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x

To set interpreter option in PyCharm go to Run|Edit Configuration

查看更多
4楼-- · 2019-01-09 02:01

in Pycharm, Run/Debug menu choose Edit Configuration, check the box before 'Show command line afterwards'

查看更多
登录 后发表回答