py2exe和library.zip [英] py2exe and library.zip

查看:77
本文介绍了py2exe和library.zip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能而不是py2exe将所有库放在一个zip文件中,

只是将它们放在子目录中?

解决方案

Timothy Smith写道:

是否有可能而不是py2exe将所有库放在一个zip文件中,
只是将它们放在子目录中?




一切皆有可能。也许你可以解释一下你实际上想要完成的事情(或原因),这样我们就可以更好地了解

你要用这个...


-Peter


Peter Hansen写道:

Timothy Smith写道:<

任何事情都有可能。也许你可以解释一下你实际上想要完成的事情(或原因),这样我们就能更好地理解你要去哪里......


正是我刚才所说的,我不想让py2exe拉上它的''库',而是将它们放在子目录中。
这个的原因,这样当用户从svn登录和更新时,他们只需要下载一些小的pyc文件,而不是一个很棒的大型zip文件,其中包含所有内容(其中99%永不改变)



关于这个版本控制的更多细节可能会有所帮助。 (这就是为什么我要求更多背景......正是我所说的
并不像(例如)那样有用我希望我的应用程序用户
使用Subversion检索应用程序的更新,而不必下载大的zip文件。

你知道Subversion(据我所知)有一个相当的<智能二进制文件比较例程,它将(再次,因为我理解它)不传输zip文件的全部内容,但
实际上只发送已更改的部分?至少,如果文件没有以某种方式压缩,以防止此算法运行良好,那就是这样的。 (注意自己:检查是否可以压缩在sys.path中的zip文件,如果py2exe压缩它们。)

无论如何,虽然这种事情不是直接支持(可能因为几乎没有人会想要这样做,因为类似于Simon所解释的原因),你应该能够自己解决这个问题。 py2exe生成的
.exe包含一个stub。基本上设置
sys.path指向.zip文件的可执行文件,然后运行已经集成到.exe文件中的主.py(甚至没有编译成.pyc,只是
像正常一样)。如果修改主.py以调整sys.path以指向外部子目录,则应该能够在其中保留.py文件(或
.pyc文件)并使用svn更新它们。

我会把它留给读者练习(主要是因为我不知道如何随意做)你应该做些什么来阻止py2exe放入
你的zip文件中的所有文件。它应该仍然可以放置标准的库模块,因为否则你没有理由首先使用py2exe ......

-Peter



理想情况下我根本不想使用py2exe,那么他们可以从我的稳定分支更新
更新SVN。这个问题是如何在他们的系统上安装python,wx,pysvn,reportlab等等没有

大惊小怪(py2exe将所有dll'包含在一起我)。如果你知道我可以实现的一种方式,我会永远成为你最好的朋友。


我要去的全部原因svn更新方法是没有

用户交互所需。甚至让用户点击一个按钮

来更新已经证明了他们的要求太多了:/


另一个原因是我的特定项目得到了更新通常,所以

您可以想象用户的组合能够抵抗任何类型的计算机使用需要经常更新的环境。

i有一些在我达到这一点之前要解决的其他问题,主要是与b bn相关的问题。 pysvn whinges因为文件存在于它想要更新的工作

目录中(使用相同的名称),只有它们

不受版本控制。


在文章< ma ******************** @ powergate.ca> ;,

Peter Hansen< pe *** @ engcorp.com>写道:

[...](自我注意:检查可以压缩在sys.path中的zip文件是否可以压缩,


是的。

如果py2exe压缩它们。)




不知道,但我认为是。


只是


is it possible instead of py2exe putting all library''s in a zip file, to
just put them in a sub dir?

解决方案

Timothy Smith wrote:

is it possible instead of py2exe putting all library''s in a zip file, to
just put them in a sub dir?



Anything''s possible. Maybe you could explain what you''re actually
trying to accomplish (or the reasons) so we can better understand where
you''re going with this...

-Peter


Peter Hansen wrote:

Timothy Smith wrote:

Peter Hansen wrote:

Anything''s possible. Maybe you could explain what you''re actually
trying to accomplish (or the reasons) so we can better understand
where you''re going with this...


exactly what i just stated, i don''t want py2exe to zip up it''s
library''s, but to put them in a sub dir.
the reason for this, is so that when users login and update from svn,
they only have to download some tiny pyc files, not a great big zip file
with everything in it ( 99% of which never changes)



More detail on this version control thing would probably help. (Things
like that are why I asked fo more background... "exactly what I stated"
isn''t as useful as something like (for example) "I want my app users to
use Subversion to retrieve updates to the application without having to
download a big zip file".)

Do you know that Subversion has (as I understand it) a fairly
intelligent binary file comparison routine, and it will (again, as I
understand it) not transmit the entire contents of the zip file but
would actually send only the portions that have changed? At least,
that''s if the file isn''t compressed in some way that prevents this
algorithm from working well. (Note to self: check if zip files that can
be in sys.path can be compressed, and if py2exe compresses them.)

Anyway, while this sort of thing isn''t directly supported (probably
since almost nobody would want to do it, for reasons similar to what
Simon has explained), you should be able to work it out yourself. The
.exe produced by py2exe contains a "stub" executable that basically sets
sys.path to point to the .zip file, then runs the main .py which has
been integrated into the .exe file (not even compiled to a .pyc, just
like normal). If you modify your main .py to adjust sys.path to point
to an external subdirectory, you should be able to leave .py files (or
.pyc files) there and use svn to update them.

I''ll leave it as an exercise for the reader (mainly because I don''t know
how to do it offhand) what you should do to prevent py2exe from putting
all your files in its zip. It should probably still put the standard
library modules there, since otherwise you''d have little reason to be
using py2exe in the first place...

-Peter


ideally i''d love to not to have to use py2exe at all, then they can just
update from the stable branch of my svn. the problem with THAT is how to
install python, wx,pysvn,reportlab etc etc on their systems with no
fuss(py2exe convienently packages all dll''s together for me). if you
know of a way i can achieve that i''d be your best friend forever.

the whole reason i''m going with the svn updating method is there is no
user interaction required. even getting users to click a single button
to update has proven too much to ask of them :/

the other reason is my particular project gets updated very often, so
you can imagine the combination of users resistant to any kind of
computer use with an environment requiring frequent updating.
i have some other problems to solve before i get to that point, mainly
svn related eg. pysvn whinges because files exist in the working
directory that it wants to update ( with the same name ), only they
aren''t under version control.


In article <ma********************@powergate.ca>,
Peter Hansen <pe***@engcorp.com> wrote:

[ ... ] (Note to self: check if zip files that can
be in sys.path can be compressed,
Yes.
and if py2exe compresses them.)



Don''t know, but I assume yes.

Just


这篇关于py2exe和library.zip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆