将ipynb笔记本转换为org并在emacs中执行

时间:2019-03-16 04:13:05

标签: emacs jupyter org-mode

我看到一些组织赞誉取代了jupyter(https://news.ycombinator.com/item?id=16842786),并尝试了它的含义。

我想将* .ipynb文件转换为* .org文件,并像在jupyter笔记本中一样在org模式下执行每个源代码块。

(我尝试了ein天,但似乎很不稳定)

我已经成功转换了https://www.reddit.com/r/emacs/comments/7lcgkz/import_a_jupyter_notebook_to_an_orgmode_file/所示的文件格式

但是我很难执行代码块,因为变量没有在代码块之间共享。

我可以使用PROPERTIES:或类似方法在相同上下文中运行它们吗? 我可以使用ipython吗?

我无法通过谷歌搜索如何为ipynb文件使用组织模式(如我尝试的那样)。
想知道是否有人共享一个工作过程

1 个答案:

答案 0 :(得分:0)

如果没有在代码块之间共享变量,则可能是由于缺少:session参数,否则每个代码块都以独立模式运行。例如,第二块应该打印i

#+begin_src python :session my_session
i = 0
#+end_src

#+begin_src python :session my_session :results output
print(i)
#+end_src

这应该引发一个NameError: name 'i' is not defined错误

#+begin_src python :results output
print(i)
#+end_src
相关问题