[Tutor] Questions about Creating Executables and Backward Compatibility

Alan Gauld alan.gauld at yahoo.co.uk
Mon Feb 22 18:49:23 EST 2021


On 22/02/2021 18:37, Shaun Keyes-McClements wrote:

> Since Python is a scripting language and does not need to be compiled, how
> would I make executables of programs written in either Python 3.1 or 3.9?

Technically you don't. Python is always interpreted.
Just like Basic and JavaScript (and even Java although
it is also compiled!) etc.

And since Python is installed by default on almost
all computers except Windows these days you often
don't need to. (And even a few Windows computers
have it nowadays. HP being one such make.)

But as Marc has pointed out there are several tools that
will build a pseudo exe that embeds and runs the interpreter
plus your Python code plus any libraries you import. To
your users it looks and feels like a single file executable
but really it's still the interpreter interpreting your code.

> exception of updates made, are Python 3x versions typically backward
> compatible? 

Yes, with a few very rare exceptions. (For example Python
dictionaries used to be unordered. But now they preserve
insertion order. So if you wrote code that relied on the
dictionary order not being fixed then it will likely break.
But that would be highly unlikely to be a realistic scenario.)

Major versions of Python are not compatible though, so v3
code won't usually work on a v2 interpreter or vice versa.
But v3.0 code should (nearly?) all work on v3.9

3.9 code may not run on v3.0 if you use any of the new features.
But a surprisingly large subset will be just fine.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list