pip install默认使用wipe选项

Cal*_*eng 17 python pip

在python(django)项目中,当我用pip更改现有依赖项的位置,并在另一台机器上重新安装更新的requirements.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 
Run Code Online (Sandbox Code Playgroud)

此时,我将选择"w"(擦除)来清除django-south的旧副本,并从新的存储库位置使用django-south.

我想将此作为默认行为,而无需键入"w".

给我的时候我可以指定一个选项

pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)

命令,以便安装过程会自动知道我要删除旧版本,不会提示我选择s/i/w/b?

小智 30

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

--exists-action = EXISTS_ACTION路径已存在时的默认操作.如果某个选项不可用,请使用此选项多次指定另一个操作,选项:(s)witch,(i)gnore,(w)ipe ,(b)ackup


Jua*_*hin 13

您可以使用以下yes命令:

yes w | pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)