ob-ipython: Searching for program: No such file or directory, jupyter even when jupyter is installed

一开始是打开 Org 文件报下面这个错误:

File mode specification error: (json-readtable-error 47)

找到了

toggle-debug-on-error 给出了

Debugger entered--Lisp error: (json-readtable-error 47)
  signal(json-readtable-error (47))
  json-read()
  json-read-from-string("/bin/bash: jupyter: command not found\n")
  ob-ipython--get-kernels()
  ob-ipython-auto-configure-kernels()
  run-hooks(change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook))
  run-mode-hooks(org-mode-hook)
  org-mode()
  set-auto-mode-0(org-mode nil)

然后就按照第一个链接那样 pip install jupyter,然后把 export PATH=$PATH:/home/username/.local/bin 加入 ~/.bashrc。重启了电脑,在命令行中输入 which jupyterjupyter 都能给出结果。但是打开 Org 文件仍然报上面的错误。

在 ielm 中

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (with-temp-buffer (org-mode))
*** Eval error ***  Wrong type argument: stringp, nil

在 Org 文件中 C-c C-c 执行下面代码块,会给出 apply: Searching for program: No such file or directory, jupyter

#+BEGIN_SRC ipython :session :results raw drawer
  %matplotlib inline
  import matplotlib.pyplot as plt
  import numpy as np
#+END_SRC

但是现在在命令行中输入 which jupyterjupyter 都能给出结果,请问该怎么解决这个问题呢?

PS. 系统为 arch,有 python2 存在,不知道会不会对这个产生什么影响

通过 customize exec-path,把 which jupyter 的目录加进去,解决了 C-c C-c Org block 找不到 jupyter 的问题,但是打开 Org 文件仍然报 File mode specification error: (json-readtable-error 47) 这个错误。

customize ob-ipython-commandwhich jupyter 的值就可以解决 File mode specification error: (json-readtable-error 47) 这个问题了。但是还是不明白为什么要自己 customize 这些值,明明在命令行里执行 jupyter 已经没问题了。

还存在一个问题是,ielm 中 (with-temp-buffer (org-mode)) 仍然有问题:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (with-temp-buffer (org-mode))
*** Eval error ***  Wrong type argument: stringp, nil
ELISP> (with-temp-buffer (markdown-mode))
nil