Closed millejoh closed 9 years ago
I totally agree, on my system I want to use Python 3, but with IPython on Emacs, I want to use Python 2.7
Anyway, there is a variable called python-shell-interpreter that holds the chosen python version inside emacs: the version that should be used instead. Therefore, in the code
(defun ob-ipython--create-driver ()
(when (not (ignore-errors (process-live-p (ob-ipython--get-driver-process))))
(ob-ipython--create-process "ob-ipython-driver"
(list (locate-file (if (eq system-type 'windows-nt) "python.exe" "python")
exec-path)
ob-ipython-driver-path
(number-to-string ob-ipython-driver-port)))
;; give driver a chance to bind to a port and start serving
;; requests. so horrible; so effective.
(sleep-for 1)))
we should read python-shell-interpreter
(if (eq system-type 'windows-nt) "python.exe" python-shell-interpreter)
instead of "python"
(if (eq system-type 'windows-nt) "python.exe" "python")
Changing that fixed my issue with ob-ipython (It was using Python 3 instead of Python 2.7 to run the driver, and the module "jupyter_client" was not found).
Yep, customizing this makes a lot of sense. I went with the python-shell-interpreter suggestion. Just pushed now. Let me know if this doesn't solve your problem. Thanks to you both.
At the moment ob-ipython will look for the first python it finds in PATH, but this won't work too well if a user has multiple python environments (like conda).
One thought - use Python Shell Exec Path as the default, but allow the user to specify a custom value.