分发 python 命令行工具的最佳方式是什么?
-
09-06-2019 - |
题
我现在的 setup.py
脚本工作正常,但它安装了 tvnamer.py
(工具)作为 tvnamer.py
进入站点包或类似的地方..
我可以做吗 setup.py
安装 tvnamer.py
作为 tvnamer
, 和/或是否有更好的方法来安装命令行应用程序?
解决方案
尝试一下 entry_points.console_scripts
setup() 调用中的参数。如中所述 安装工具文档, ,这应该做我认为你想要的。
在这里重现:
from setuptools import setup
setup(
# other arguments here...
entry_points = {
'console_scripts': [
'foo = package.module:func',
'bar = othermodule:somefunc',
],
}
)
不隶属于 StackOverflow