【问题标题】:entry_points does not create custom scripts with pip or easy_install in Python?entry_points 不会在 Python 中使用 pip 或 easy_install 创建自定义脚本?
【发布时间】:2013-08-05 08:41:37
【问题描述】:

我正在使用简单的入口点来制作自定义脚本,在setup.py

  entry_points = {
           'my_scripts': ['combine_stuff = mypackage.mymod.test:foo']
  }

其中mypackage/mymod/test.py 包含:

import argh
from argh import arg
@arg("myarg", help="Test arg.")
def foo(myarg):
    print "Got: ", myarg

当我使用它安装我的包时(与setup.py在同一目录中)

pip install --user -e .

入口点似乎根本没有得到处理。这是为什么呢?

如果我使用distribute easy_install 安装,例如:

easy_install --user -U .

然后入口点被处理并创建:

$ cat mypackage.egg-info/entry_points.txt 
[my_scripts]
combine_stuff = mypackage.mymod.test:foo

但在我的bin 目录中的任何位置都没有放置名为combine_stuff 的实际脚本(例如~/.local/bin/)。它似乎没有完成。这里出了什么问题?我怎样才能让它制作一个可执行的脚本,并且最好也与pip一起工作?

【问题讨论】:

    标签: python pip setuptools easy-install setup.py


    【解决方案1】:

    答案是使用console_scripts 而不是my_scripts。不清楚脚本名称是不是程序员的内部标签。

    【讨论】:

      猜你喜欢
      • 2014-03-13
      • 2014-11-06
      • 2010-10-30
      • 2010-11-05
      • 2019-03-04
      • 2023-03-12
      • 2021-12-18
      • 1970-01-01
      • 2015-01-13
      相关资源
      最近更新 更多