start ipython notebook with python file

后端 未结 4 1273
既然无缘
既然无缘 2021-02-04 20:09

I am not very familiar with python/ipython but somebody was asking me whether it is possible to start an ipython notebook with a specific python file. It then could be used for

4条回答
  •  天命终不由人
    2021-02-04 20:58

    Since the question is quite broad and asking for recommendations, here are my suggestions:

    1. cross-platform nbopen, which opens ipynb using command-line or optional explorer integration:

    https://github.com/takluyver/nbopen

    Please note that I have one open ticket for complete Windows explorer integration:

    https://github.com/takluyver/nbopen/issues/12

    [copied from github page]

    Installation:

    pip install nbopen
    

    Usage:

    nbopen AwesomeNotebook.ipynb
    
    1. run ipynb without launching the browser interface, with many useful options:

    https://github.com/paulgb/runipy

    [copied from github page]

    Installation:

    $ pip install runipy
    

    To run a .ipynb file as a script, run:

    $ runipy MyNotebook.ipynb
    

    To save the output of each cell back to the notebook file, run:

    $ runipy -o MyNotebook.ipynb
    

    To save the notebook output as a new notebook, run:

    $ runipy MyNotebook.ipynb OutputNotebook.ipynb
    

    To run a .ipynb file and generate an HTML report, run:

    $ runipy MyNotebook.ipynb --html report.html
    

提交回复
热议问题