Start ipython running a script

后端 未结 7 1004
暖寄归人
暖寄归人 2020-12-08 19:09

My use case is I want to initialize some functions in a file and then start up ipython with those functions defined. Is there any way to do something like

i         


        
7条回答
  •  半阙折子戏
    2020-12-08 19:22

    Per the docs, it's trivial:

    You start IPython with the command:

    $ ipython [options] files
    

    If invoked with no options, it executes all the files listed in sequence and drops you into the interpreter while still acknowledging any options you may have set in your ipythonrc file. This behavior is different from standard Python, which when called as python -i will only execute one file and ignore your configuration setup.

    So, just use ipython myfile.py... and there you are!-)

提交回复
热议问题