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

Lucas Raab dotpyFE at gmail.com
Sat Aug 20 16:42:08 CEST 2005


Miernik wrote:
> On my Debian GNU/Linux system I have Python 2.3 installed in
> /usr/lib/python2.3/ where most Python system files like 
> 
> /usr/lib/python2.3/gzip.py
> /usr/lib/python2.3/gzip.pyc
> /usr/lib/python2.3/gzip.pyo
> 
> live, besides of course /usr/bin/python2.3
> 
> 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?
> 
> The whole /usr/lib/python2.3/ directory takes up over 15 MB, deleting
> two "flavours" would save about 10 MB on my system, and that would help
> me much as I am trying to fit my system on a 256 MB SD card, to make it
> quiet (hard disks are noisy).
> 
> Can I just do 
> cd /usr/lib/python2.3/ && rm -rf *.py && rm -rf *.pyc 
> for example, and everything will still work as before?
> 

You can delete any two of the three and you shouldn't run into any 
problems. However, the .py files are the source code and .pyc and .pyo 
are compiled Python files. The .pyc and .pyo files will load faster 
because they are compiled. Also, if you keep the .py files and then 
execute them, .pyc files will be generated. In short, I would keep the 
.pyc files and delete the others.

-- 
--------------------------
Lucas Raab
lvraab"@"earthlink.net
dotpyFE"@"gmail.com
AIM:	Phoenix11890
MSN:	dotpyfe "@" gmail.com
IRC:	lvraab
ICQ:	324767918
Yahoo:	Phoenix11890



More information about the Python-list mailing list