Org-mode babel python 会话不产生结果

Dav*_*ave 4 python org-mode python-babel

我正在尝试使用 org-mode 和 babel 编写一个代码测试用例,但无法完成第一步:

* Running code example

Set up some variables
#+begin_src python :results output :session
x=1
#+end_src


Use some variables (in the end I'll have more useful
explanatory text between the code blocks).
#+begin_src python :exports both :results output :session 
print "Hi", x
#+end_src
Run Code Online (Sandbox Code Playgroud)

C-c由于第二个块尚未定义,因此按顺序击中块会失败x

导出文件(如果重要的话导出为 PDF)似乎会执行所有代码块,但RESULTS第二个块的 代码不会被构造并插入到缓冲区中。

如何修改代码块上的开关,以便所有内容都在会话中执行,并将结果嵌入到组织缓冲区中?

org-version=7.9.3f

all*_*rts 5

为会话命名,例如:

    #+name: session_init
    #+BEGIN_SRC python :results output :session example
    str='Hello, World'
    #+END_SRC

    #+RESULTS: session_init
    : 
    : str='Hello World'
    : >>> >>> >>>
    : 

    #+BEGIN_SRC python :results output :session example
    print str
    #+END_SRC

    #+RESULTS:
    : print str
    : Hello, World
    : 
Run Code Online (Sandbox Code Playgroud)