pip install 中的方括号是什么意思? [英] 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]"
<小时>
在您的情况下,您正在安装
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
的支持.请注意,它与 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 install 中的方括号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!