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?



Sample configuration:

 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:

  • The customisable variable 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 commandtype' would display, but also a PATH/TO/EXECUTABLE

If different flavours of Python are installed, customize py-python-command versions

  py-python-command (default)

  • It must looks like this? (setq py-shell-name "python" py-python-command-args "-i /absolute/path/to/manage.py shell_plus") – sivakov512 Jan 16 '17 at 12:05
  • @CryptoManiac No. BTW with python-mode.el no customization should be needed for basic use. Just call M-x python RET, resp. M-x pythonVERSION RET. In case of questions: answers.launchpad.net/python-mode, menu Answers – Andreas Röhler Jan 16 '17 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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