I've got python 3.6 in this directory:


How can I set in .emacs path to python 3.6 interpreter?

  • 2
    Set that path for what? A guess is that you want to be able to invoke the external Python interpreter from Emacs. If so, it sounds like you just need to ensure that it is reachable from your Path environment variable. That's not really an Emacs question. It seems you are on MS Windows. Go to Control Panel > System > Advanced System Settings > Environment Variables, and update variable Path (or add the var if not there).
    – Drew
    Commented Jul 1, 2017 at 18:38
  • 2
    Please do not post the same question to StackOverflow and SE.emacs. Pick one or the other. Please delete one of the posts. Thx.
    – Drew
    Commented Jul 1, 2017 at 18:40
  • Thx for answer. I want to use Python 3.6 interpreter, something like this: (setq py-python-command "/usr/local/bin/python2.3") Commented Jul 1, 2017 at 18:43

2 Answers 2

(setq exec-path (append exec-path '("d:/Python36/")))
  • Where shall one write this? Isn't exec-path too generic?
    – VP.
    Commented Feb 11, 2020 at 13:06

python-shell-interpreter is the variable you are looking for. You can set it using

(setq python-shell-interpreter "D:\Python36")

Add this to your .emacs and reload python process.

  • Thanks for answer, but it gives me error: Specified program for new process is a directory. I'm using elpy. Commented Jul 2, 2017 at 16:02
  • You should set path to executable like D:\Python36\python. Commented Jul 2, 2017 at 16:04
  • Now I've got this error :spawning child process invalid argument Commented Jul 2, 2017 at 16:11
  • Use forward slashes instead: D:/Python36/python. Backslash has a special meaning in Emacs, so if you want to use them, you have to escape them first (with, incidentally, a backslash) like so: C:\\Python36\\python. As you can see, it's easier to just use forward slashes instead.
    – Enfors
    Commented Feb 11, 2021 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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