组织模式babel python会话不会产生结果
我正在尝试使用组织模式和babel编写代码测试用例,但无法通过第一步:组织模式babel python会话不会产生结果,python,org-mode,python-babel,Python,Org Mode,Python Babel,我正在尝试使用组织模式和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
* 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
从第二个块开始,按顺序在块上点击C-C
失败
未定义x
导出文件(如果需要的话,则导出为PDF)似乎执行了所有
代码块,但未构造第二个块的结果
并插入缓冲区
如何修改代码块上的开关,以便
在会话中执行,结果嵌入到
组织缓冲区
org version=7.9.3f
为会话命名,例如:
#+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
:
它与较新的组织模式(如8.2.10)一起工作;Org8.0有重大变化,所以最好的方法是升级你的组织模式 我没有Python,所以我无法尝试。但我看不出它不起作用的明显原因,只要它是在会话中运行的。你不需要在session参数后添加一个名称吗?尝试添加一个session名称——同样的问题。对我来说,在org模式v8.2.10中,它可以正常工作。