pip安装中的方括号是什么意思? [英] What do square brackets mean in pip install?

查看:366
本文介绍了pip安装中的方括号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到越来越多的这样的命令:

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将安装两个名为splinterdjango的软件包.另一方面,splinter[django]安装splinter软件包的变体,其中包含对django support .请注意,它与django程序包本身无关,而只是由splinter程序包为启用的特定功能集定义的字符串.

The command pip install splinter django would install two packages named splinter and django. splinter[django], on the other hand, installs a variant of the splinter package which contains support for django. Note that it has nothing to do with the django package itself, but is just a string defined by the splinter package for a particular feature set that gets enabled.

这篇关于pip安装中的方括号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆