擅长:python、mysql、java
<p><strong>还可以使用<code>--execute</code>获得输出</strong></p>
<pre><code>jupyter nbconvert --execute --to html notebook.ipynb
</code></pre>
<p>这将生成一个<code>notebook.html</code>文件。</p>
<p>最好的做法是不将输出放在用于版本控制的笔记本中,请参见:<a href="https://stackoverflow.com/questions/18734739/using-ipython-notebooks-under-version-control">Using IPython notebooks under version control</a></p>
<p>但是,如果不通过<code>--execute</code>,则输出将不会出现在HTML中,另请参见:<a href="https://stackoverflow.com/questions/35545402/running-ipynb-from-terminal">How to run an .ipynb Jupyter Notebook from terminal?</a></p>
<p>对于没有头的HTML片段:<a href="https://stackoverflow.com/questions/12502187/ipython-notebook-to-html-for-blog-post">How to export an IPython notebook to HTML for a blog post?</a></p>
<p>在Jupyter 4.4.0中测试。</p>