Pyc platform independent?

I recently started python development on raspberry pi. Reading about the .pyc file to speed up startup I was wondering if I am testing a .pyc file on a PC, given that the same python modules are available in Rpi, would it work directly? Also specify what happens if the python version or any module version is different on the target platform.

Thanks in advance.

+3


source to share


2 answers


Compiled Python bytecode files are architecture independent, but VM dependent. Pyc file will only work in a specific set of Python versions, determined by the magic number stored in the file .



+5


source


Short answer: Yes. Just keep in mind that your code must be in the OS too.



And use the same python version on both platforms.

-3


source







All Articles