Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write a simple Python script using Geany. This IDE will automatically compile the code I write but I'm not sure which version of Python it is using. If I enter python --version in the command line I get:

Python 2.7.3

but if I enter python3 I get:

Python 3.2.3 (default, Oct 19 2012, 19:53:16) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Does Ubuntu come with both versions? If so, which one is Geany using to compile?

share|improve this question
up vote 5 down vote accepted

Ubuntu comes with both versions, yes. The python command will always point to a Python 2.x version, and python3 will always point to the default Python 3.x version. The python command will never point to Python 3.x.

I'm not sure what Geany uses exactly, but I would suspect it uses Python 2.x (and thus probably puts #!/usr/bin/python (or should put if it uses /usr/bin/env python instead), in the scripts it generates.

share|improve this answer

Try running import sys;print(sys.version_info) from inside geany.

share|improve this answer
I get sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0) so I guess it's using python 2.7.3. – Gabriel Mar 24 '13 at 0:21
@Gabriel Indeed, also, you should mark either my answer or dobey's as the solution. – GUIpsp Mar 24 '13 at 0:38

You can use:

import sys
print sys.version  

To find out what version of python you are running.

Of course due to changes in python 3 print is now a function so this won't work for version 3. In that case you would use:

import sys
share|improve this answer

Your Answer


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.