What is the easiest way to build Python26.zip for embedded distribution?

感情迁移 提交于 2019-12-05 21:17:07

It shouldn't be too difficult to write a script for that. Check out the zipfile.PyZipFile class and it's writepy method.

I would probably use setuptools to create an egg (basically a java jar for python). The setup.py would probably look something like this:

from setuptools import setup, find_packages

setup(
    name='python26_stdlib',
    package_dir = {'' : '/path/to/python/lib/directory'},
    packages = find_packages(),
    #any other metadata
)

You could run this using python setup.py bdist_egg. Once you have the egg, you can either add it to the python path or you can install it using setuptools. I believe this should also handle the generation of pycs for you as well.

NOTE: I wouldn't use this on my system python directory. You might want to set up a virtualenv for this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!