Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python 3 in emacs

I changed two days ago to Emacs 23, which lately gave me a lot of headache, especially, as I have two Python versions installed, the older 2.7 and 3. As I generally want to start the python 3 interpreter, it would be nice if I could tell Emacs in some way to use python 3 instead of 2.7.

Besides, I could not find a module which helps to highlight python3 syntax. I am currently using python-mode.el for highlighting.

Also, if somebody had a good tip for which module would be best to show the pydoc, I would be very thankful.

Thanks in advance!

like image 988
YumTum Avatar asked Jun 17 '12 13:06

YumTum


1 Answers

  • [RET] = enter or return key.
  • M = Meta or Alt key.

If you feel like letting Emacs do the heavy lifting for you, go through the Emacs settings dialogue to have Emacs set it automatically.

M-x customize-variable [RET] python-shell-interpreter [RET]

A new buffer should appear where you can customize the python interpreter you are using.

The field to the right of Python Shell Interpreter: will be the current interpreter your are using. In my case it was python so I changed it to python3. Then move the curer to select the Apply and Save button above and hit [RET] to make Emacs respect the new setting. Alternatively you can click the button with the mouse.

Next time you open the Emacs python interpreter, it will be using the new python you set from the setting dialogue.

like image 121
serv-inc Avatar answered Nov 02 '22 01:11

serv-inc