Python Shell in Emacs 24?

Dan Jaouen picture Dan Jaouen · Jan 14, 2012 · Viewed 21.1k times · Source

I recently upgraded from Emacs 23 to Emacs 24. Since the upgrade, it seems that I've lost the ability to call "M-x python-shell" (!).

What happened? Does the included python mode no longer ship with this functionality?

Using Emacs 23:

○ /usr/local/bin/emacs -Q

Describe function: python-shell
    python-shell is an interactive autoloaded Lisp function in
    `python.el'.

Using Emacs 24:

○ /Applications/Emacs.app/Contents/MacOS/Emacs -Q

Describe function: python-shell [No match]

Answer

Shantanu picture Shantanu · Mar 15, 2012

It seems like you only solved the python-mode issue. As to M-x-python-shell you can also get this by doing M-x-run-python. If it says directory not found its because the the python variable is not pointing to the correct path. So do C-h-f run-python then it will tell you that run-python's value is python-shell-interpreter. So then point it to python.exe in your python folder.

add this to your .emacs file

(setq python-shell-interpreter "path to python.exe")

Then like in emacs 23 you can do C-c-C-c to run a .py file.

edit-the reason i have all of this here even though you may already of known this is because i didnt realize that emacs24 changed the python value for run-python for a while and this is how i fixed it. :D