New project: Python 2 or Python 3?

UPDATE: My original answer was given in 2012. However, now, years later, the answer should and must be Python 3.


This wiki discusses exactly your question: Should I use Python 2 or Python 3 for my development activity?

This is a very large subjective part to this question which depends on exactly your specific situation and constraints.

IMO, however, if you can't be sure that all 3rd party libraries you need will work with Python v3.x I would stick with Python 2.x but try to write code to be as compatible with Python 3.x as much possible (e.g., print() etc) so that if you ever need or want to migrate to v3 your work won't be so challenging. And of course there are documentation and tools on moving from version 2 to 3. And this on porting v2 code to v3.

This will especially be the case on systems where you don't have control or can't install newer versions of Python or customize the installation of 3rd party software/libraries.

Given that your software will be run on a wide variety of systems (Linux, Windows, Mac ..) and by a number of different users I still think that v2 is more of a common denominator these days.

So, short-attention-span summary: Use version 2.x but perpare your code for v3.x

Finally, if you put this search string "[python] version 3 or 2" into the SO search box, you'll find a number of related posts:


Python 3. (The answer to this question has changed!)

Python 2 is for legacy projects. New projects should lean towards Python 3.

The reason for this is that Python 3 (now 3.6) is roughly getting a new release each year. It has also been stable for many years (is in its tenth release year!). In contrast, Python 2 (still 2.7) has changed little in the last several years and will continue to grow stagnant.

For more information: https://wiki.python.org/moin/Python2orPython3/