1.项目写完后在项目根目录创建setup.py并写入如下内容:
from setuptools import setup
setup(
name='ModelFunction', # 包名字
version='1.0', # 包版本
description='This is a model tool based on sklearn', # 简单描述
author='ys', # 作者
author_email='yansheng@powersi.com.cn', # 作者邮箱
url='', # 包的主页
packages=['ModelFunction'], # 包
)
2.生成.whl文件:打开cmd进入项目目录,输入如下命令:python setup.py bdist_wheel生成.whl文件,该文件位于项目目录dist文件夹中
3.安装.whl文件:以管理员身份运行cmd,进入需安装该模块的python环境的scripts目录,如:D:\Python3.7\Scripts,然后输入以下命令pip install 路径\文件名.whl,如:D:\PyCharm\Projects\ModelFunction\dist\ModelFunction-1.0-py3-none-any.whl