A forum for general discussion of the Python programming language.


Postby bliss » Thu May 09, 2013 3:47 am


Let's say an app was developed using Python 3.x
If someone buys the app and only Python 2.x is installed in his/her computer, will the application run properly???

How about the other way...
If the app is developed using Python 2.x
And the user has upgraded their installed Python from Python 2.x to 3.x, will it run properly or not?

Is there a way to distribute python applications that are not dependent on what is installed on the user's computer?
Posts: 15
Joined: Thu May 09, 2013 3:42 am

Re: Compatibility

Postby Mekire » Thu May 09, 2013 6:22 am

In most, but not all cases, it is entirely possible to write programs to be compatible with both python 2.7 and 3.x. The caveat of this is library availability however. If you use a library for your application that is not available for the other version of Python then you are fairly out of luck. This is actually the primary reason 2.x is still around. Many of the modules people rely on simply haven't been converted.

So if you are certain that the libraries you use are available in both versions then you will probably be fine. You of course still need to confirm for yourself that it runs on both however as there are many tiny stupid things that can stop the program from working on both cleanly.

Most common silly reasons for compatibility failing between 2.x and 3.x:
print statement vs print() function
raw_input vs input
xrange vs range
integer division default vs true division default

All of those are easily handled though and don't pose a problem.

On the commercial side here, if you are actually selling an app you probably aren't going to distribute as plain source code anyway though. You would use some program like py2exe or cxfreeze or py2app or whatever to package the program for whatever platform you were targeting (if people wanted to extract your source code they probably would succeed though but it would be a deterrent). This case would also require you to test and confirm functonality.

New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

Re: Compatibility

Postby bliss » Thu May 09, 2013 9:55 am

Ok... I see...
Thank you very much :)
Posts: 15
Joined: Thu May 09, 2013 3:42 am

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 7 guests