On: Aquamacs 3.3 GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109)) of 2016-09-19 in mac osx sierra

i changed my ~/Library/Preferences/Aquamacs Emacs/Preferences.el with the below:

(setq python-version-checked t) (setq py-python-command "python3.5")

(eval-after-load "org" '(org-babel-do-load-languages 'org-babel-load-languages '((sh . t) (python . t) (emacs-lisp . t) (ditaa . t) )))

but it still fails to point to python 3.5. Thanks!


I discovered that just setting in the file: ~/Library/Preferences/Aquamacs Emacs/Preferences.el

(setq org-babel-python-command "python3")

Does the job. However, i don't really understand why it worked here and not in the ob-python.el file directly. If anyone has a view, please share.

  • What do you mean by "here" vs "in the ob-python.el file directly"? – Basil May 26 '17 at 9:43
  • This solution also works if the line is added to .emacs.el or .emacs.d/init.el – Frank M Jul 24 '18 at 19:09
  • It may be safer and more flexible to add this in a file variable. You may end up using python3 while wanting/thinking/needing python2. Using M-x add-file-local-variable, then selecting org-babel-python-command and setting it to "python3" (notice the quotes), it changes the variable only for the current file. You need to revert the buffer. You may also need to validate this local change of variable. You can check the python version by importing the sys module and printing the version print(sys.version). – Lalylulelo Apr 24 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.