pythonライブラリパブリケーション

1012 ワード

setup.py

from distutils.core import setup
setup(
    name = 'test02',
    version = '1.0.0',
    py_modules = ['test02'],
    author = 'hfpython',
    author_email = '[email protected]',
    url = 'www.xxx.com',
    description = 'test'
    )


test02.py

def print_lol(lst):
        for l in lst:
            #                      
            if isinstance(l,list):
                print_lol(l)
            else:
                print(l)


Windowsはディレクトリに入力:f:Python 33python.exe setup.py sdist,linuxはpython 3 setupと入力.py sdist,sudo python3 setup.py install
dist同級ディレクトリのtest 03.pyで実行できます(ps、私の環境はwin 7です)
test03.py

import test02
test02.print_lol((('a','b'),('c','d')))