[英]Error running custom command in setup.py
我正在運行Python 3.6.3,並且一直在嘗試向setup.py
添加自定義命令。
據我所知,我所做的工作似乎與我在該主題上看到的各種教程和示例相匹配,但是我無法使其正常工作。
我已將setup.py
減至最少。 這里是:
import setuptools
class FooCommand(setuptools.Command):
user_options = []
"""Custom build command."""
def initialize_options(self):
"""Abstract method that is required to be overwritten"""
def finalize_options(self):
"""Abstract method that is required to be overwritten"""
def run(self):
print("Running foo command...")
setuptools.setup(
cmdClass={'foo': FooCommand}
)
當我運行python setup.py foo
我收到以下錯誤:
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'cmdClass'
warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'foo'
我終於明白了。 cmdClass
有一個錯字。 它應該是cmdclass
即所有小寫字母。
setuptools.setup(
cmdClass={'foo': FooCommand}
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.