Reputation: 2967
I have a python application running in an embedded Linux system. I have realized that the python interpreter is not saving the compiled .pyc files in the filesystem for the imported modules by default.
How can I enable the interpreter to save it ? File system permission are right.
Upvotes: 0
Views: 642
Reputation: 295373
There are a number of places where this enabled-by-default behavior could be turned off.
PYTHONDONTWRITEBYTECODE
could be set in the environmentsys.dont_write_bytecode
could be set through an out-of-band mechanism (ie. site-local initialization files, or a patched interpreter build).strace
or a similar tool (as available for your platform) to determine whether any attempts to create these files exist.On an embedded system, it makes much more sense to make this an explicit step rather than runtime behavior: This ensures that performance is consistent (rather than having some runs take longer than others to execute). Use py_compile
or compileall
to explicitly run ahead-of-time.
Upvotes: 2