gpt4 book ai didi

python - 构建成功后 pip 不删除源

转载 作者:行者123 更新时间:2023-12-02 11:22:10 24 4
gpt4 key购买 nike

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

- pip:
name: "git+https://github.com/ansible/ansible.git#egg=ansible"
state: latest
become: yes

然后在随后的运行中,我收到消息:

fatal: [ansibletarget]: FAILED! => {"changed": false, "cmd": "/usr/local/bin/pip install -U -e git+https://github.com/ansible/ansible.git#egg=ansible", "failed": true, "msg": "stdout: Obtaining ansible from git+https://github.com/ansible/ansible.git#egg=ansible\n Updating ./src/ansible clone\n Complete output from command git reset --hard -q origin/master:\n \n ----------------------------------------\n\n:stderr: Could not find a tag or branch 'origin/master', assuming commit.\nfatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git [...] -- [...]'\nCommand \"git reset --hard -q origin/master\" failed with error code 128 in /tmp/src/ansible\n"}



/tmp/src我有一个 ansible子目录以及 pip-delete-this-directory.txt文件。 Pip 并没有删除它。

相同的行为(下载,未删除,后续调用出错)发生在:
pip install -U -e git+https://github.com/ansible/ansible.git#egg=ansible

基本上我希望我的剧本是幂等的。我可以在安装之前删除目标文件夹并解决问题,但是缺少什么以便 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).

最佳答案

使用这种设置很难实现幂等行为。您可以通过编写 checkout 存储库的代码来解决它,如果存储库已经 checkout ,只需执行 git pull origin master 和一些 pip 工作。问题是你真的想要那个吗?
有一个发布存储库专门用于获取 Ansible 的打包版本,它比尝试 pip 安装更适合这种情况。
Debian特定安装:
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-debian

关于python - 构建成功后 pip 不删除源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34133736/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com