[英]What do (s)witch, (i)gnore, (w)ipe, (b)ackup options mean when installing a package from repository using pip?
When installing a package using pip, I get the following message:使用 pip 安装软件包时,我收到以下消息:
Obtaining some-package from git+git://github.com/some-user/some-package.git@commit-hash#egg=some_package-dev (from -r requirements.txt
(line 3))
git clone in /Users/me/Development/some-env/src/some-package exists with
URL https://github.com/some-user/some-package.git
The plan is to install the git repository git://github.com/some-user/some-package.git
What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup
I see that this particular case is probably caused by a change of protocol in URL (new requirement uses git://
, while the one already installed uses https://
).我看到这种特殊情况可能是由 URL 中的协议更改引起的(新要求使用
git://
, git://
安装的要求使用https://
)。
However, I wonder what exactly happens if I choose either of the choices (switch, ignore, wipe, backup).但是,我想知道如果我选择其中一个选项(切换、忽略、擦除、备份),究竟会发生什么。 I'm unable to find an explanation in pip documentation.
我无法在 pip 文档中找到解释。
A patch explaining this option was merged into the PIP documentation, but it was not released until Pip 6.0 (2014-12-22).解释此选项的补丁已合并到 PIP 文档中,但直到 Pip 6.0 (2014-12-22) 才发布。 ( https://github.com/pypa/pip/commit/b5e54fc61c06268c131f1fad3bb4471e8c37bb25 ).
( https://github.com/pypa/pip/commit/b5e54fc61c06268c131f1fad3bb4471e8c37bb25 )。 Here is what that patch says:
这是该补丁的内容:
--exists-action option
--exists-action 选项
This option specifies default behavior when path already exists.
此选项指定路径已存在时的默认行为。 Possible cases: downloading files or checking out repositories for installation, creating archives.
可能的情况:下载文件或检出存储库进行安装,创建档案。 If
--exists-action
is not defined, pip will prompt when decision is needed.如果
--exists-action
,则 pip 将在需要决定时进行提示。
(s)witch
(s)女巫
Only relevant to VCS checkout.
仅与 VCS 结帐相关。 Attempt to switch the checkout to the appropriate url and/or revision.
尝试将结帐切换到适当的 url 和/或修订版。
(i)gnore
(i) 忽略
Abort current operation (eg don't copy file, don't create archive, don't modify a checkout).
中止当前操作(例如,不要复制文件、不要创建存档、不要修改签出)。
(w)ipe
(w) ipe
Delete the file or VCS checkout before trying to create, download, or checkout a new one.
在尝试创建、下载或签出新文件之前删除文件或 VCS 签出。
(b)ackup
(b) 备份
Rename the file or checkout to
{name}{'.bak' * n}
, where n is some number of.bak
extensions, such that the file didn't exist at some point.将文件或检出重命名为
{name}{'.bak' * n}
,其中 n 是一些.bak
扩展名,因此该文件在某些时候不存在。 So the most recent backup will be the one with the largest number after.bak
.因此,最近的备份将是
.bak
之后编号最大的备份。
And here is a link to description of that option in the now-updated documentation: https://pip.pypa.io/en/stable/cli/pip/#exists-action-option .这是现在更新的文档中对该选项的描述的链接: https : //pip.pypa.io/en/stable/cli/pip/#exists-action-option 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.