简体   繁体   English

Python setup.py install 指定 extras_require

[英]Python setup.py install specify extras_require

I have "extras_require" declared in setup.py.我在 setup.py 中声明了“extras_require”。 Is there a way I can specify optional features with something like python setup.py[extras] install .有没有一种方法可以指定可选功能,例如python setup.py[extras] install

I know that pip can handle optional features like:我知道pip可以处理可选功能,例如:

pip install .[extras]

or或者

pip install -e .[extras]

Is there something like python setup.py install [extras] or python setup.py develop [extras] that can do the similar things.有没有像python setup.py install [extras]python setup.py develop [extras]这样的东西可以做类似的事情。 Or is there another way to tell python setup.py to install some optional requirements.或者是否有另一种方法告诉python setup.py安装一些可选要求。

python setup.py install easy_install pkg_name[extras]

or或者

python setup.py develop easy_install pkg_name[extras]

This of course requires pkg_name to already exist in the search paths.这当然要求pkg_name已经存在于搜索路径中。 It shouldn't install pkg_name a second time since the install / develop option would've already installed it.它不应该第二次安装pkg_name因为install / develop选项已经安装了它。 However the extras will be processed.然而, extras将被处理。

The advantage of this over pip install (options) .[extras] is that you can pass specific options to build / install / develop .pip install (options) .[extras]相比,它的优势在于您可以将特定选项传递给build / install / develop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM