I just wrote a script in jupyer notebook and I’m wondering what’s the best format I should save this file as if I want to share it with other people so they can run it on their windows computer? I tried to convert my .ipynb to both .py and .exe, but none seem to work… maybe I’m doing something wrong.
Advertisement
Answer
Converting a Jupyter Notebook to a .py or .exe file would make no sense, as notebooks are used for the purpose to execute certain blocks of code on click. You could convert the notebook and it’s output to a .pdf File, as you can read here: How to convert IPython notebooks to PDF and HTML?
If you want to port your Jupyter Notebook to a Python file, you’d have to make sure that you include all the code in the .py file, which is written down in the notebook as well. Keep in mind that, when using a regular Python File, things obviously won’t look as great as in Jupyter.
The best way to share your Notebooks, would be to send them the actual file, so they can open the notebook in Jupyter notebook, or – in case they don’t want to install Jupyter or Python on their device – they could use an online version of Jupyter Notebook like: https://nbviewer.jupyter.org/ – There are multiple websites available, which offer that kind of service.