4

I've got python 3.6 in this directory:

D:\Python36

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

Drew
  • 75,699
  • 9
  • 109
  • 225
jestembotem
  • 43
  • 1
  • 3
  • 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 Jul 01 '17 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 Jul 01 '17 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") – jestembotem Jul 01 '17 at 18:43

2 Answers2

4

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.

Chillar Anand
  • 4,042
  • 1
  • 23
  • 52
  • Thanks for answer, but it gives me error: Specified program for new process is a directory. I'm using elpy. – jestembotem Jul 02 '17 at 16:02
  • You should set path to executable like `D:\Python36\python`. – Chillar Anand Jul 02 '17 at 16:04
  • Now I've got this error :spawning child process invalid argument – jestembotem Jul 02 '17 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 Feb 11 '21 at 10:20
3
(setq exec-path (append exec-path '("d:/Python36/")))
eflanigan00
  • 785
  • 4
  • 11