2008-08-20 88 views

回答

33

嘗試setup()調用中的entry_points.console_scripts參數。如setuptools docs中所述,這應該做我認爲你想要的。

要重現此:

from setuptools import setup 

setup(
    # other arguments here... 
    entry_points = { 
     'console_scripts': [ 
      'foo = package.module:func', 
      'bar = othermodule:somefunc', 
     ], 
    } 
) 
+7

當我嘗試這與Python 2.6和3.1,我得到一個消息`UserWarning:未知分發選項:「entry_points'`。所以我想它在Python(2.6和3.1)附帶的`distutils`中不受支持。那麼,如果我們想要在PyPI上發佈,可以使用這個選項嗎? – 2010-03-17 01:04:02