Python 成功生成后,Pip不会删除源

Python 成功生成后,Pip不会删除源,python,pip,ansible,Python,Pip,Ansible,我正在使用Ansible的pip模块(Debian上的pip 7.1.2)从github安装Ansible: 然后在随后的运行中,我得到了以下信息: 致命:[ansibletarget]:失败!=>{“changed”:false,“cmd”:/usr/local/bin/pip安装-U-e git+,“failed”:true,“msg”:"标准输出:从git+\n更新中获取ansible。/src/ansible克隆\n从命令git reset--hard-q origin/master完成

我正在使用Ansible的pip模块(Debian上的pip 7.1.2)从github安装Ansible:

然后在随后的运行中,我得到了以下信息:

致命:[ansibletarget]:失败!=>{“changed”:false,“cmd”:/usr/local/bin/pip安装-U-e git+,“failed”:true,“msg”:"标准输出:从git+\n更新中获取ansible。/src/ansible克隆\n从命令git reset--hard-q origin/master完成输出:\n\n----------------------------------------------------------------------\n\n:stderr:找不到标记或分支“origin/master”,假设提交。\n结果:参数“origin/master”不明确:未知修订或路径不在工作区中树。\n使用“---”将路径与修订分开,如下:\n'git[…]--[…]'\n命令\“git reset--hard-q origin/master \”在/tmp/src/ansible\n“}中失败,错误代码为128

/tmp/src
中,我有一个
ansible
子目录以及
pip删除这个目录。txt
文件。不过pip不会删除它

以下情况也会发生相同的行为(下载、未删除、后续调用出错):

pip install -U -e git+https://github.com/ansible/ansible.git#egg=ansible
基本上,我希望我的playbook是幂等的。我可以在安装之前删除目标文件夹,这就解决了问题,但是缺少了什么,以便
pip
不会像其内容所建议的那样删除内容:

This file is placed here by pip to indicate the source was put
here by pip.

Once this package is successfully installed this source code will be
deleted (unless you remove this file).

使用此设置很难实现幂等行为。您可以通过编写代码签出存储库来解决此问题,如果存储库已签出,则只需执行git pull origin master和一些pip工作。问题是您真的想要这样做吗

有一个发布库专门用于获取Ansible的打包版本,该版本比尝试pip安装更适合此场景

特定于Debian的安装:


我更改了name=“git+“state=latest,可用于后续运行。由于出现错误,它保存了源代码,因此您可以自己检查并查看问题所在。另外,/tmp下的任何内容都会被自动删除,它只是一个临时文件夹。我也遇到了同样的问题,你解决了吗?我注意到了聪明的巴西的答案,但我不确定它的作用。
This file is placed here by pip to indicate the source was put
here by pip.

Once this package is successfully installed this source code will be
deleted (unless you remove this file).