https://python-packaging-zh.readthedocs.io/zh_CN/latest/command-line-scripts.html#scripts
setuptools可以将命令行工具添加到包中.有两种方法:
1.scripts参数 把命令工具卸载单独的文件中,一般放在bin目录下
test/ test/ __init__.py ... setup.py bin/ test-test ...在setup.py中添加
setup( ... scripts=['bin/test-test'], ... )2.console_scripts console_scripts是一个’entry points,允许python的一个def注册成命令行工具.
test/ test/ __init__.py command_line.py ... setup.py ...修改command_line.py模块只提供命令行工具:
import test def main(): print test.aa()在setup.py中注册main()
setup( ... entry_points = { 'console_scripts': ['test-aa=test.command_line:main'], } ... )