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

查看:94
本文介绍了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 将安装两个名为splinterdjango 的包.另一方面,splinter[django] 安装了 splinter 包的一个变体,其中包含对 django支持.请注意,它与 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 install 中的方括号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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