0%

python打包-setuptools

首先安装setuptools(一般默认都有)

1
pip install setuptools

目录结构
mypack
├──__init__.py
setup.py

__init__.py

1
2
3
4
5
6
7
8
9
10
#encoding='utf-8'
def max(x, y):
if x>y:
reuturn x
else:
return y

if __name__ == '__main__'
max(x, y)

setup.py

1
2
3
4
5
6
7
8
9
from setuptools import setup, find_packages
setup(
name="bxwmax",
version="1.0.0",
description="max min module",
author="bxw",
url="https:www.xublog.wang",
packages = find_packages()
)

python setup.py bdist_egg 就可以打包了,出现的是以.egg为后缀的zip文件
bdist_wininst 生成exe文件

1
2
python setup.py check
python setup.py bdist_egg

安装

1
python setup.py install