can I delete one of *.py *.pyc *.pyo in /usr/lib/python2.3 ?

Magnus Lycka lycka at carmen.se
Mon Aug 22 04:22:21 EDT 2005


Miernik wrote:
> I noticed that all those files come in three "flavours":
> *.py *.pyc *.pyo
> 
> Is it possible that only one "flavour" of these files is needed, and I can
> delete the remaining two, any my Python installation will still work?

If you remove all *.pyc and *.pyo, they will be regenerated as needed.
If your code only uses a small fraction of the standard library, you
will save quite some space here. The only reason they are generated on
installation is to save some runtime on first use of a module, and 
perhaps aviod the surprise of an installation that continues to grow
after a completed installation...

I'm not sure about this, but if you have plenty of RAM (you will
trade HD noise for fan noise I guess) you might get the *.py[co] files
to stay on a RAM disk. (If nothing else works, I guess you could have
your system mirror your entire Python directory structure to RAM disk
at boot time.) Then you should have a Python system which will get
really fast once most modules have been recompiled--until you reboot...



More information about the Python-list mailing list