Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I know which compiler is used when I type python myapp.py in terminal?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Ask it.

$ python -V
Python 2.6.4
share|improve this answer
    
Is it the compiler name or just the python version? –  Nick.h Sep 27 '11 at 20:28
1  
The compiler is CPython. Jython is invoked as jython or some variant thereof, and IronPython is invoked as IronPython.exe. –  Ignacio Vazquez-Abrams Sep 27 '11 at 20:30
    
Is there a command to get CPython? –  Nick.h Sep 27 '11 at 20:35
    
Yes. The command is python. –  Ignacio Vazquez-Abrams Sep 27 '11 at 21:12
1  
python is not a compiler but an interpreter. @Nick.h CPython (en.wikipedia.org/wiki/CPython) is a common python interpreter. –  Matteo Sep 28 '11 at 6:40
show 2 more comments
$ which python

/usr/bin/python

This will tell you which python is being used.

share|improve this answer
1  
It is possible that this command could differ from the version of python being used, as it only considers $PATH. It's better practise to use type -p. –  Chris Down Sep 27 '11 at 21:11
    
Good info, thanks Chris. –  Somantra Sep 27 '11 at 21:15
add comment

When you run

python myapp.py

in your terminal, no compiler is used. Python interprets the file myapp.py.

share|improve this answer
1  
Incorrect. Python bytecompiles the script, and then runs the bytecode in its VM. –  Ignacio Vazquez-Abrams Sep 28 '11 at 5:57
add comment

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.