自定义Python运行时 [英] Custom Python Runtime

查看:80
本文介绍了自定义Python运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于完全安装Python(来自标准安装程序或

ActiveState安装程序)对于我的预期用途来说太大了,我想构建一个

自定义分发Python for Windows平台,省略一些lib文件,

,如音频,tk,打印,测试单元等。


有没有自定义Windows构建的方法?在我的情况下,没有必要

来构建安装程序。最好的方法是将目录中的所有内容都包含在内,因为我知道在哪里可以找到Python,Python知道在哪里可以找到

必需的库。有任何在线文档描述这个吗?谢谢!

解决方案

Jack写道:


自从完全安装Python(来自标准安装程序或

ActiveState安装程序)对于我的预期用途而言太大了,我想构建一个用于Windows平台的Python自定义分发版本,省略一些lib文件,

,如音频,tk,打印,测试单元等。


有没有办法自定义Windows版本?在我的情况下,没有必要

来构建安装程序。最好的方法是将目录中的所有内容都包含在内,因为我知道在哪里可以找到Python,Python知道在哪里可以找到

必需的库。有任何在线文档描述这个吗?谢谢!



也许最简单的方法是从标准分发开始,

只需删除你不想要的东西。

我认为Unicode表格相当大,如果你不需要它们就可以省略。


-

Gabriel Genellina


4月7日凌晨1点52分,杰克 < nos ... @ invalid.comwrote:


自从完全安装Python(来自标准安装程序或

ActiveState安装程序) )对于我的预期用途来说太大了,我想建立一个用于Windows平台的Python自定义发行版,省略一些lib文件,

如音频, tk,打印,测试单位等。


有没有办法自定义Windows版本?在我的情况下,没有必要

来构建安装程序。最好的方法是将目录中的所有内容都包含在内,因为我知道在哪里可以找到Python,Python知道在哪里可以找到

必需的库。有任何在线文档描述这个吗?谢谢!



原则上只需要输入pythonxx.dll即可。如果你想要

来隔离那些脚本和额外的库你的项目

要求你可以试试py2exe,即使你还没有最终计划

来交付可执行文件。 py2exe因素和复制所需的一切

完整的应用程序。对于构建你可以注释掉包含在

的头文件python.h但是这通常不会给你带来那么多。


有没有办法自定义Windows版本?在我的情况下,没有必要


来构建安装程序。最好的方法是将目录中的所有内容都包含在内,因为我知道在哪里可以找到Python,Python知道在哪里可以找到

必需的库。有任何在线文档描述这个吗?谢谢!



解释器将搜索相对于.exe文件的位置

的库。所以如果你把python.exe和pythonxy.dll放到

a目录中,你需要添加一个Lib目录


Inside Lib,你需要的最小文件有os.py:Python将

用它作为里程碑。如果你运行''python.exe -S'',这就是你需要的全部




如果你想让site.py工作,你也可以需要(测试2.4):

- 网站,编解码器,copy_reg,locale,ntpath,stat,类型UserDict,

编码/ __ init__,编码/别名


如果从site.py中删除了aliasmbcs函数,你可以删除

编解码器,语言环境,编码/ *。


如果你从os.py中删除了copy_reg引用,你也可以删除

copy_reg。


HTH,

Martin


Since the full installation of Python (from either the standard installer or
ActiveState installer) is too big for my intended use, I''d like to build a
custom distribution of Python for Windows platform, omitting some lib files,
such as audio, tk, printing, testing units, etc.

Is there a way to customize the Windows build? In my case, there is no need
to build an installer. The best way is to have everything in a directory, as
long as I know where to find Python and Python knows where to find the
necessary libs. Any online docs describing this? Thanks!

解决方案

Jack wrote:

Since the full installation of Python (from either the standard installer or
ActiveState installer) is too big for my intended use, I''d like to build a
custom distribution of Python for Windows platform, omitting some lib files,
such as audio, tk, printing, testing units, etc.

Is there a way to customize the Windows build? In my case, there is no need
to build an installer. The best way is to have everything in a directory, as
long as I know where to find Python and Python knows where to find the
necessary libs. Any online docs describing this? Thanks!

Perhaps the easiest way is start with the standard distribution and
just delete whatever you don''t want.
I think that the Unicode tables are rather big and could be omited if
you don''t need them.

--
Gabriel Genellina


On Apr 7, 1:52 am, "Jack" <nos...@invalid.comwrote:

Since the full installation of Python (from either the standard installer or
ActiveState installer) is too big for my intended use, I''d like to build a
custom distribution of Python for Windows platform, omitting some lib files,
such as audio, tk, printing, testing units, etc.

Is there a way to customize the Windows build? In my case, there is no need
to build an installer. The best way is to have everything in a directory, as
long as I know where to find Python and Python knows where to find the
necessary libs. Any online docs describing this? Thanks!


In principle it suffices to drop in just the pythonxx.dll. If you want
to isolate those scripts and additional libraries your project
requires you might try out the py2exe even when you don''t finally plan
to deliver an executable. py2exe factors and copies everything needed
for a complete application. For builds you can comment out includes in
the header file python.h but this won''t usually buy you that much.


Is there a way to customize the Windows build? In my case, there is no need

to build an installer. The best way is to have everything in a directory, as
long as I know where to find Python and Python knows where to find the
necessary libs. Any online docs describing this? Thanks!

The interpreter will search for its libraries relative to the location
of the .exe file. So if you place python.exe and pythonxy.dll into
a directory, you need to add a Lib directory

Inside Lib, the minimum file you need to have is os.py: Python will
use it as a landmark. If you run ''python.exe -S'', this is all
you need.

If you want site.py to work, you also need (tested for 2.4):
- site, codecs, copy_reg, locale, ntpath, stat, types UserDict,
encodings/__init__, encodings/aliases

If you eliminate the aliasmbcs function from site.py, you can drop
codecs, locale, encodings/*.

If you eliminate the copy_reg references from os.py, you can also drop
copy_reg.

HTH,
Martin


这篇关于自定义Python运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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