本文介绍了Python * .py,* .pyo,* .pyc:嵌入式系统可以消除哪些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了减少目前正在使用的嵌入式系统中有限的文件系统存储空间,我想删除任何可以合理删除的文件,而不会对功能或性能造成重大影响。 Python库帐户中的* .py,* .pyo和* .pyc文件占用了大量的空间,我想知道在小型嵌入式系统中安装Python 2.6时,哪些选项最合适? / p>
- 保留* .py,消除* .pyc和* .pyo(维护调试能力,性能受损) $ b
- 保持* .py和* .pyc,消除* .pyo(优化是否真的买东西?)
- 保留* .pyc,消除* .pyo和* .py (这会工作吗?)
- 保留* .py,* .pyc和* .pyo(全部需要?)
$ b
> http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html
我的建议给你
如果您不需要assert语句和__doc__字符串,请使用-OO仅编译 .pyo 文件。
否则,只能使用 .pyc 。
修改
我注意到你只提到了Python库。如果您只需要部分功能,则可以删除大部分python库。
我还建议您查看 tinypy
To squeeze into the limited amount of filesystem storage available in an embedded system I'm currently playing with, I would like to eliminate any files that could reasonably be removed without significantly impacting functionality or performance. The *.py, *.pyo, and *.pyc files in the Python library account for a sizable amount of space, I'm wondering which of these options would be most reasonable for a Python 2.6 installation in a small embedded system:
- Keep *.py, eliminate *.pyc and *.pyo (Maintain ability to debug, performance suffers?)
- Keep *.py and *.pyc, eliminate *.pyo (Does optimization really buy anything?)
- Keep *.pyc, eliminate *.pyo and *.py (Will this work?)
- Keep *.py, *.pyc, and *.pyo (All are needed?)
解决方案
http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html
My suggestion to you?
Use -OO to compile only .pyo files if you don't need assert statements and __doc__ strings.
Otherwise, go with .pyc only.
Edit
I noticed that you only mentioned the Python library. Much of the python library can be removed if you only need part of the functionality.
I also suggest that you take a look at tinypy which is large subset of Python in about 64kb.
这篇关于Python * .py,* .pyo,* .pyc:嵌入式系统可以消除哪些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!