Python嵌入问题。 [英] Python embedding question.
问题描述
对不起我几周前发布了一个类似的问题,但我没有得到
答案。我想在具有有限
资源的设备上嵌入Python应用程序,尤其是存储限制。有没有办法将Python
解释器缩减为一组迫切需要的模块?或者是否有一个
方法可以将gzip压缩模块随时解压缩到内存中
当它们被访问时?那会更好。
另外,是否有一个Python模块包含嵌入式应用程序所需的所有东西
,如图形,声音等等。我是否需要使用各种绑定到cairo,Qt或类似的库?
是否有网站可以帮助做出这些决定?
>
我真的看了很多地方但还没找到合适的
解决方案,所以我在这里要求希望有人有经验
与该主题。
问候,
托马斯。
Hi,
Sorry I''ve posted a similar question some weeks ago, but I got no
answers. I want to embed a Python application on a device with limited
resources, esp. storage limitations. Is there a way to reduce the Python
interpreter to a set of modules that''s urgently needed? Or is there a
method to have gzipped modules that are unzipped on the fly into memory
when they''re accessed? That would be even better.
Additionally, is there a Python module that contains all the stuff
needed for an embedded application like graphics, sound etc. or do I
have to use the various bindings to libraries like cairo, Qt or similar?
Is there a site that helps with those decisions?
I''ve really looked at a lot of places but haven''t found a suitable
solutions yet, so I''m asking here in hope that someone has experience
with that topic.
Regards,
Thomas.
推荐答案
7月15日,11:51,Thomas Troeger< thomas.troeger .... @ siemens.com>
写道:
On 15 Jul., 11:51, Thomas Troeger <thomas.troeger....@siemens.com>
wrote:
我真的看了很多地方,但还没有找到合适的
解决方案,所以我在这里要求希望有人有经验
与该主题。
I''ve really looked at a lot of places but haven''t found a suitable
solutions yet, so I''m asking here in hope that someone has experience
with that topic.
您排除了哪些解决方案?
Which solutions did you rule out?
Kay Schluehr写道:
Kay Schluehr wrote:
7月15日,11:51,Thomas Troeger< thomas.troeger .... @ siemens.com>
写道:
On 15 Jul., 11:51, Thomas Troeger <thomas.troeger....@siemens.com>
wrote:
>我真的看过很多地方但还没有找到合适的解决方案,所以我在这里问我希望有人有经验
与该主题。
>I''ve really looked at a lot of places but haven''t found a suitable
solutions yet, so I''m asking here in hope that someone has experience
with that topic.
您排除了哪些解决方案?
Which solutions did you rule out?
- Python + Qt,因为它对我的计划来说肯定有点过分。我只需要
需要简单的图形和一些声音,没有小部件。基本上我正在寻找
的东西非常轻量级,有绘制图形的方法
基元和渲染字体 - 没有复杂的小部件,窗口,
滚动条等。而且,例如,Qt库是一个真正的
重量级,约有。单独为qt-3.3.8 10 MB。
- cairo / pango也一样,我写了一个测试程序(在C中,我是
必须说)有10个库的动态链接,大小都是250kb
。这对于一个小型嵌入式设备来说非常重要。
我想要一个解决方案,一共不超过10MB,并且口译员
如果包含所有模块,则为60 MB。我无法想象没有人在这之前遇到过这个问题吗?我正试图不再发明这个问题:^)
- Python + Qt, because it''s definitely overkill for my plans. I only
need simple graphics and some sound, no widgets. Basically I''m looking
for something really lightweight that has methods for drawing graphic
primitives and renders fonts -- no complicated widgets, windows,
scrollbars and the like. And, for example, the Qt library is a real
heavyweight with approx. 10 MB for qt-3.3.8 alone.
- The same holds for cairo/pango, I''ve written a test program (in C, I
must say) that has dynamic links to 10 libraries that are all like 250kb
in size. That''s a lot for a small embedded device.
I''d like a solution that''s not over 10MB altogether, and the interpreter
comes at a 60 MB if all modules are included. I can''t imagine noone has
had this problem before... and I''m trying to not invent the wheel again :^)
7月15日12:14,Thomas Troeger< thomas.troeger .... @ siemens.com>
写道:
On 15 Jul., 12:14, Thomas Troeger <thomas.troeger....@siemens.com>
wrote:
Kay Schluehr写道:
Kay Schluehr wrote:
7月15日,11:51,Thomas Troeger< thomas.troeger .... @ siemens.com>
写道:
On 15 Jul., 11:51, Thomas Troeger <thomas.troeger....@siemens.com>
wrote:
我真的看了很多地方但是避风港还没找到合适的
解决方案,所以我在这里要求希望有人有这个主题的经验
。
I''ve really looked at a lot of places but haven''t found a suitable
solutions yet, so I''m asking here in hope that someone has experience
with that topic.
您排除了哪些解决方案?
Which solutions did you rule out?
- Python + Qt,因为它对我的计划来说肯定有点过分。我只需要
需要简单的图形和一些声音,没有小部件。基本上我正在寻找
的东西非常轻量级,有绘制图形的方法
基元和渲染字体 - 没有复杂的小部件,窗口,
滚动条等。而且,例如,Qt库是一个真正的
重量级,约有。单独为qt-3.3.8 10 MB。
- cairo / pango也一样,我写了一个测试程序(在C中,我是
必须说)有10个库的动态链接,大小都是250kb
。这对于小型嵌入式设备来说非常重要。
- Python + Qt, because it''s definitely overkill for my plans. I only
need simple graphics and some sound, no widgets. Basically I''m looking
for something really lightweight that has methods for drawing graphic
primitives and renders fonts -- no complicated widgets, windows,
scrollbars and the like. And, for example, the Qt library is a real
heavyweight with approx. 10 MB for qt-3.3.8 alone.
- The same holds for cairo/pango, I''ve written a test program (in C, I
must say) that has dynamic links to 10 libraries that are all like 250kb
in size. That''s a lot for a small embedded device.
你试过pygame吗?我认为它的占地面积很小。
问候,Uwe
Did you try pygame ? I think it has a small footprint.
Greetings, Uwe
这篇关于Python嵌入问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!