pip安装中的方括号是什么意思? [英] What do square brackets mean in pip install?
问题描述
我看到越来越多的这样的命令:
I see more and more commands like this:
$ pip install "splinter[django]"
这些方括号有什么作用?
What do these square brackets do?
推荐答案
您使用的语法是:
pip install "project[extra]"
在您的情况下,您是installing
splinter
软件包,其中对django
的支持有所增加.方括号([]
)不是特定的语法,只是约定.确实,您正在安装名为"splinter[django]"
的软件包.
In your case, you are installing
the splinter
package which has the added support for django
. The square brackets ([]
) are not specific syntax, just convention. Really, you are installing the package named: "splinter[django]"
.
@chetner
的解释:
命令
pip install splinter django
将安装两个名为splinter
和django
的软件包.另一方面,splinter[django]
安装splinter
软件包的变体,其中包含对django
的 support .请注意,它与django
程序包本身无关,而只是由splinter
程序包为启用的特定功能集定义的字符串.
The command
pip install splinter django
would install two packages namedsplinter
anddjango
.splinter[django]
, on the other hand, installs a variant of thesplinter
package which contains support fordjango
. Note that it has nothing to do with thedjango
package itself, but is just a string defined by thesplinter
package for a particular feature set that gets enabled.
这篇关于pip安装中的方括号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!