使用defau的擦除选项进行pip安装

2024-07-04 14:24:15 发布

您现在位置:Python中文网/ 问答频道 /正文

在python(django)项目中,当我用pip更改现有依赖项的位置时,重新安装更新的要求.txt文件在另一台机器上,我会收到一条类似于这:在

Obtaining South from git+git://github.com/lambdafu/django-south.git@7bb081348d854d0b1aa82b87da5b446ad5d6f2a6#egg=South-dev (from -r requirements.txt (line 5))
  git clone in ./src/south exists with URL git://github.com/clones/django-south.git
  The plan is to install the git repository git://github.com/lambdafu/django-south.git
What to do?  (s)witch, (i)gnore, (w)ipe, (b)ackup 

此时,我将选择“w”(wipe)清除django south的旧副本,并从新的存储库位置使用django south。在

我想这样做作为一个默认行为,而不需要键入“w”。在

在给我的

^{pr2}$

命令,以便安装过程自动知道我要清除旧副本,并且不会提示我选择s/I/w/b?在


Tags: pip文件to项目djangofromgitgithub
2条回答

您可以使用yes命令:

yes w | pip install -r requirements.txt

从PIP 1.1版起,您还可以使用:

exists action=存在操作 路径已存在时的默认操作存在。使用这 选项多次指定另一个操作如果 某个选项不可用,选项:(s)女巫, (i) gnore,(w)ipe,(b)备用

相关问题 更多 >

    热门问题