打包前配置setup文件(构建工具)
- 配置文件
from setuptools import setup
setup(
name="pytest_encode",
version="0.1.1",
description="pytest plugins",
author="",
author_email="",
url="",
classifiers=[
"Framework :: Pytest",
"Programming Language :: Python",
"Topic :: Software Development :: Testing",
"Programming Language ::Python :: 3.9",
],
packages=["pytest_encode"],
install_requires=[
"pytest"
],
entry_points={
"wangmin": [
"pytest-encode=pytest_encode"
]
}
)
安装打包工具
- 打包需要两个工具:
wheel、setuptools
,setuptools
自带了不需要安装。执行pip install wheel
进行安装![在这里插入图片描述](https://img-blog.csdnimg.cn/20210627182733984.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDg4ODQ0Ng==,size_16,color_FFFFFF,t_70)
打包
- 执行命令
python setup.py sdist bdist_wheel
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210627182853491.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDg4ODQ0Ng==,size_16,color_FFFFFF,t_70)
- 生成几个文件
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210627182950888.png)
.gz
:源码包,.whl
:whl包,可以用过pip install
进行安装
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210627183330792.png)