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

前端 未结 2 901
遥遥无期
遥遥无期 2021-02-01 08:48

I\'m not quite sure how to build a really simple one-file source module. Is there a sample module out there one the web somewhere which can be built as a python .egg?

Fr

2条回答
  •  走了就别回头了
    2021-02-01 09:42

    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.

提交回复
热议问题