python: simple example for a python egg with a one-file source file?

本秂侑毒 提交于 2019-12-02 19:38:31

You can use the py_modules argument instead of the packages argument to list single file modules.

See https://docs.python.org/3/distutils/setupscript.html#listing-individual-modules

For distutils, from https://docs.python.org/3/distutils/introduction.html#a-simple-example :

from distutils.core import setup
setup(name='foo',
      version='1.0',
      py_modules=['foo'],
      )

Then you only need a file:

foo.py

And in Ubuntu 14.04:

sudo python setup.py

puts it under:

/usr/local/lib/python2.7/dist-packages/foo.py

without any directories.

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