Reputation: 141
In a python source block in org-mode, after hitting C-c C-c, emacs says
Evaluation of python source block is disabled
Could anyone explain why?
Upvotes: 6
Views: 3853
Reputation: 316
Simon's answer is not right if the org-mode version is >= 9. Here is another question on the same problem.
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. To do that, start emacs, then
C-0 M-x byte-recompile-directory RET ~/emacs.d/elpa/org-xxxx
Details at here.
Update 1: EmacsWiki on compile file.
Upvotes: 11
Reputation: 3174
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. 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 inorg.el
. Original value was((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. When a language is "loaded", then code blocks in that language can be evaluated with
org-babel-execute-src-block
bound by default toC-c C-c
(note theorg-babel-no-eval-on-ctrl-c-ctrl-c
variable can be set to remove code block evaluation from theC-c C-c
keybinding. By default only Emacs Lisp (which has no requirements) is loaded.You can customize this variable.
This variable was introduced, or its default value was changed, in version 24.1 of Emacs.
Upvotes: 2