windows10 想在Org中运行pyhon3 报‘ no org-babel-execute function for python' 试过几个配置没有效

已写入了代码

(setq exec-path-from-shell-check-startup-files nil)
(when (memq window-system '(mac ns x))
  (exec-path-from-shell-initialize)
  )


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


#+begin_src python :results output 
import sys
print(sys.version)
#+end_src

#+begin_RESULTS
#+end_RESULTS

win10
C-c C-c 一直报 no org-babel-execute function for python 不知道是怎么设置 是没有加载系统环境变量,还是其它设置

你试的不太对,这是判断是不是 macOS,貌似没看到 exec-path-from-shell 这个 package 用在 Windows 上,直接设置 PATH 不知道行不行

  (setq python-shell-interpreter "your_python_path"
        org-babel-python-command "your_python_path")
(setq python-shell-interpreter "e:\\python\\python3.8.1\\python.exe"
      org-babel-python-command "e:\\python\\python3.8.1\\python.exe"
      )
;; 这两个都试了 还是 no org-babel-execute function for pythob 
(setq python-shell-interpreter "e:\\python\\python3.8.1\\"
      org-babel-python-command "e:\\python\\python3.8.1\\"
      )

这就是我不愿意用 Windows 的原因 :persevere:。Linux 上很简单就可以配置好的环境,Windows 上弄起来好麻烦。深表同情,但是无能为力 :zipper_mouth_face:

It should be org-babel-load-languages instead of org-babel-do-load-languages in the second line.

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

https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg01587.html

1 个赞