Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am new to emacs and I am trying to set python3 as default interpreter. I have installed from software centre the python plugin for emacs.

I can run a python3 file going to pyexec-->execute file...-> python3 file and in a similar way I can run a region of code pyexec-->execute region-> execute region python3

I would like to execute python3 file and region using keyboard short cut

In particular i need something to run all the file and something to run the lightened region of code

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Set py-shell-name to python3, for example by using

Meta+x customize-variable Returnpy-shell-name

share|improve this answer
    
thanks for answer but I am very new to emacs. Can you explain a little better? What is the value of customize-variable and after return should I write python3 or py-shell-name? –  Donbeo Apr 7 at 17:17
    
Press Meta-x, then Emacs will ask you for a command to run. Type customize-variable. Now Emacs will ask you for a variable to customize. Type py-shell-name. Emacs will open a Custom buffer where you can change the value for Py Shell Name. Change it to python3 and klick the Apply and Save button. –  Florian Diesch Apr 7 at 17:29
    
when I type py-shell-name I receive a no match message and nothing else –  Donbeo Apr 7 at 17:35
    
ok it is partially working I have been able to follow your instruction after that I opened a python file. The problem is that now the command C-c l that was previously used to run a region of code in python 2.7 do not work anymore. I would like to use the command C-c l to run a region of code in python3 shell –  Donbeo Apr 7 at 17:40
    
By default "Execute Region" is bound to C-c | (pipe key) not C-c l (lower case L). Customizing py-shell-name shouldn't change the keyboard bindings. –  Florian Diesch Apr 7 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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