1.制作setup.py
from distutils.core import setup setup(name='Myblog',
version='1.0',
description='My Blog Distribution Utilities',
author='lujianxing',
author_email='lujianxing@lujianxing.com',
url='http://blog.lujianxing.com',
py_modules=['foo'] )
py_modules 定义 需要打包的模块名
2.创建foo.py文件
class MyClass():
def __init__(self):
self.blog = "http://blog.dd.com"
def printblog(self):
print self.blog
def printBblog(self):
print self.blog.swapcase()
执行命令 python setup.py sdist 会打包安装包成tar
执行命令 python setup.py install 会安装安装包