简体   繁体   English

为什么在emacs org模式下禁用对此python代码块的评估?

[英]Why is evaluation of this python code block disabled in emacs org mode?

In a python source block in org-mode, after hitting Cc Cc, emacs says emacs说,在org-mode中的python源块中,在点击Cc Cc之后

Evaluation of python source block is disabled 禁用对python源块的评估

Could anyone explain why? 谁有人解释为什么?

Simon's answer is not right if the org-mode version is >= 9. Here is another question on the same problem. 如果组织模式版本为> = 9。这里是另一个西蒙的答案是不正确的问题,同样的问题。

The solution 解决方案

cd .emacs.d
cd elpa
cd org-xxxx
rm *.elc

Then, it's better to byte-recompile the directory of the org-xxxx. 然后,最好对字节重新编译org-xxxx的目录。 To do that, start emacs, then 为此,请启动emacs

C-0 M-x byte-recompile-directory RET ~/emacs.d/elpa/org-xxxx

Details at here . 细节在这里

Update 1: EmacsWiki on compile file. 更新1:编译文件上的EmacsWiki

In order to evaluate an org-mode code block of a specific language you will have to customize org-babel-load-languages as described here . 为了评估特定语言的组织模式的代码块,你将不得不定制org-babel-load-languages描述在这里 Evaluating the following will probably resolve your issue: 评估以下内容可能会解决您的问题:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)))

From the docs: 来自文档:

org-babel-load-languages is a variable defined in org.el . org-babel-load-languagesorg.el定义的变量。 Original value was ((emacs-lisp . t)) 原值为((emacs-lisp . t))

Languages which can be evaluated in Org-mode buffers. 可以在组织模式缓冲区中评估的语言。 This list can be used to load support for any of the languages below, note that each language will depend on a different set of system executables and/or Emacs modes. 此列表可用于加载对以下任何语言的支持,请注意每种语言将取决于一组不同的系统可执行文件和/或Emacs模式。 When a language is "loaded", then code blocks in that language can be evaluated with org-babel-execute-src-block bound by default to Cc Cc (note the org-babel-no-eval-on-ctrl-c-ctrl-c variable can be set to remove code block evaluation from the Cc Cc keybinding. By default only Emacs Lisp (which has no requirements) is loaded. 当一个语言被“加载”时,那个语言的代码块可以用org-babel-execute-src-block进行评估,默认绑定到Cc Cc (注意org-babel-no-eval-on-ctrl-c-ctrl-c变量可以设置为从Cc Cc键绑定中删除代码块评估。默认情况下,只加载Emacs Lisp(没有要求)。

You can customize this variable. 您可以自定义此变量。

This variable was introduced, or its default value was changed, in version 24.1 of Emacs. 在Emacs的版本24.1中引入了此变量,或者更改了其默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM