Vincent Vincent - 2 months ago 37
Python Question

Running .ipynb from terminal?

I apologize in advance if this has already been asked, but I did some googling, and I couldn't find an answer to a seemingly simple question.

I have some code in a .ipynb file and got it to the point where I don't really need the "interactive" feature of IPython Notebook. I would like to just run it straight from a Mac Terminal Command Line.

Basically, if this were just a .py file, I believe I could just do python filename.py from the command line. Is there something similar for a .ipynb file?

Answer

From the command line you can convert a notebook to python with this command:

ipython nbconvert --to python <YourNotebook>.ipynb

You may have to install the python mistune package:

sudo pip install mistune
Comments