When I use default inferior shell I can set something like this:
(setq python-shell-interpreter "python"
python-shell-interpreter-args "-i /absolute/path/to/manage.py shell_plus")
How set this with python-mode.el
?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communitySample configuration:
(setq-default
py-shell-name "python" ; \ Default value under Unices
py-python-command "python" ; /
py-python-command-args '("-i" "/absolute/path/to/manage.py" "shell_plus"))
Being the package's maintainer, Andreas Röhler's answer is of course entirely correct and based on the project's README
.
I recommend you read section Selecting a Python shell
from this file, but perhaps I can elaborate on what I think you are looking for:
py-shell-name
is the path to the default python executable that gets run when you invoke M-x py-shell
(which command is bound to C-c !
by default).python-mode.el
defines multiple customisable variables for holding python interpreter arguments:
py-python-command-args
py-python2-command-args
py-python3-command-args
py-ipython-command-args
Which one takes effect depends on the value of py-shell-name
and/or any shebang in your source file. The shebang also determines which interpreter gets selected amongst the customisable variables
py-python-command
py-python2-command
py-python3-command
py-ipython-command
Variables py-python-command
and py-python-command-args
are the fallback when the other flavours of python executable are not detected.
This is my understanding following a cursory glance at the package's source, so I might have misunderstood or missed something.
Either way, I recommend you read the project's README
and have a look at the settings in M-x customize-group RET python-mode RET
.
Customize default Python shell as `py-shell-name'
py-shell-name' might be an installed default executable as shell
command
type' would display, but also a PATH/TO/EXECUTABLE
If different flavours of Python are installed, customize py-python-command versions
py-python-command (default)
py-python2-command
py-python3-command
py-ipython-command
py-python-command-args
py-python2-command-args
py-python3-command-args
py-ipython-command-args
(setq py-shell-name "python" py-python-command-args "-i /absolute/path/to/manage.py shell_plus")
Jan 16, 2017 at 12:05