本文介绍了如何从终端运行.ipynb Jupyter笔记本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.ipynb文件中有一些代码,并且我不需要IPython Notebook的交互式功能。我想直接从Mac终端命令行运行它。

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.

基本上,如果这只是一个.py文件,我相信我可以做python文件名。 py来自命令行。 .ipynb文件有类似的东西吗?

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?

推荐答案

从命令行可以使用以下命令将笔记本转换为python:

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

ipython nbconvert --to python <YourNotebook>.ipynb

您可能需要安装python mistune 包裹:

You may have to install the python mistune package:

sudo pip install mistune

这篇关于如何从终端运行.ipynb Jupyter笔记本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 15:17