IPython workflow (edit, run)

后端 未结 13 1304
后悔当初
后悔当初 2020-12-04 06:30

Is there a GUI for IPython that allows me to open/run/edit Python files? My way of working in IDLE is to have two windows open: the shell and a .py file. I edit the .py file

13条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 07:11

    You can use the autoreload module in IPython to automatically reload code.

    Open jupyter qtconsole or jupyter console and type:

    %load_ext autoreload
    %autoreload 2
    from your_work_file import *
    

    Now every time you save your_work_file.py, it will be automatically reloaded.

    Hint: if you want this to happen automatically, put the followinglines in your ipython_config.py file:

    c.InteractiveShellApp.extensions = ['autoreload']         
    c.InteractiveShellApp.exec_lines = ['%autoreload 2']
    

提交回复
热议问题