running python 2 vs 3

Ned Batchelder ned at
Thu Mar 20 19:45:06 CET 2014

On 3/20/14 1:47 PM, Marko Rauhamaa wrote:
> Mark H Harris <harrismh777 at>:
>> If you wanted to you could run your python scripts from the .pyc file
>> alone. In other words, you may import as long as the .pyc file exists
>> and the source does not need to be there. Some folks use this (not
>> recommended) trick to hide or obfuscate their source from their
>> users).
> I've seen it done, but at least in those Python 2 days the pyc format
> changed between minor releases of Python, so Python itself had to be
> shipped with the pyc files.

Python3 still makes no guarantees about the compatibility of bytecode 
(and therefore .pyc files) across versions of Python, so if you want to 
run from pure .pyc files, you have to be sure to use the same version of 
Python that produced the files.


> Marko

Ned Batchelder,

More information about the Python-list mailing list