I want to use mac-ports python instead of default Apple. When I exec run-python I get the default python. I could not find any reference under customize-groupand customize-variable.

2 Answers 2


The variable you want is python-shell-interpreter. You can set it with (setq python-shell-interpreter "/path/to/python")


Also, if you want to set the Python interpreter on-the-fly, you can do C-u M-x run-python, which will prompt for the interpreter to use:

run-python is an interactive autoloaded compiled Lisp function in python.el.

(run-python &optional CMD DEDICATED SHOW)

Run an inferior Python process.

Argument CMD defaults to python-shell-calculate-command return value. When called interactively with prefix-arg, it allows the user to edit such value and choose whether the interpreter should be DEDICATED for the current buffer. When numeric prefix arg is other than 0 or 4 do not SHOW.

For a given buffer and same values of DEDICATED, if a process is already running for it, it will do nothing. This means that if the current buffer is using a global process, the user is still able to switch it to use a dedicated one.

Runs the hook inferior-python-mode-hook after comint-mode-hook is run. (Type C-h m in the process buffer for a list of commands.)

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.