pip 定制化打包
1.setup.py文件与工程目录同级
setup.py
from setuptools import setup, find_packages #这个包没有的可以pip一下
setup(
name = "Python-Runner", #这里是pip项目发布的名称
version = "1.0.9", #版本号,数值大的会优先被pip
packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), # 包含所有App中除去test的包
keywords = ("python_runner"),
description = "An feature extraction runner",
long_description = "An feature extraction runner, improve the python-runner",
license = "MIT Licence",
url = "https://github.com/kxs",
author = "kxs",
author_email = "kxs@163.com",
package_data={
'': ['*.txt'], # 保留所有包下.txt文件
'python_runner': ['Api/*.dat'], # 保留python_runner下Api包下的.dat文件
},
platforms = "any",
install_requires = ["flask","flask-restful","flask-sqlalchemy","flask-migrate"] #这个项目需要的第三方库
)
2.打包
pip包将保存在dist目录
python setup.py sdist
3.查看所打的pip源码包
4.安装pip包
pip install Python-Runner-1.1.0.tar.gz
5.验证pip包
以上就是定制化打造自己的pip包