赞
踩
参考:
https://blog.csdn.net/qq_38844437/article/details/126628564
https://click.palletsprojects.com/en/7.x/setuptools/#setuptools-integration
学习写法:https://github.com/myshell-ai/MeloTTS/blob/main/setup.py
yourscript.py:
import click
@click.command()
def cli():
"""Example script."""
click.echo('Hello World!')
setup.py:
from setuptools import setup setup( name='yourscript', version='0.1', py_modules=['yourscript'], install_requires=[ 'Click', ], entry_points=''' [console_scripts] yourscript=yourscript:cli ''', )
参考:https://blog.csdn.net/qq_38844437/article/details/126628564
学习写法yolo:https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml
https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" #... [project] # ... name = "apap" version = "1.0" requires-python = ">=3.8" authors = [ { email = "yangtze_lv@163.com" }, { name = "Wenchao Lv" } ] dependencies = [ "setuptools==65.3.0", "wheel==0.37.1", "opencv-contrib-python==4.5.5.62", "opencv-python==4.5.5.62", "matplotlib==3.5.3", "numpy==1.23.2", "matplotlib==3.5.3" ] # ... [tool.setuptools.packages.find] where = ["src"] include = ["apap"] [project.scripts] apap = "apap.main:main"
前面打包里setup.py设置了entry_points;pyproject.toml设置了project.scripts模块;安装后就可以有将Python模块转变为命令行工具
参考:https://blog.51cto.com/mouday/3040500
yolo ***
tts ***
apap ****
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。