Ansible剧本:错误消息;找不到任何要使用的pip3。“需要安装pip”;

Ansible剧本:错误消息;找不到任何要使用的pip3。“需要安装pip”;,ansible,Ansible,我试图通过ansible在我的剧本中安装boto3 我试图在我的主机上创建一个新用户 - name: "test user" hosts: test tasks: - name: "install boto3" pip: name: boto3 executable: pip3 我得到了这个信息: {"changed": false, "msg": "Unable to find any of pip3 to use. pip nee

我试图通过ansible在我的剧本中安装boto3

我试图在我的主机上创建一个新用户

- name: "test user"
  hosts: test
  tasks:
   - name: "install boto3"
      pip:
        name: boto3
        executable: pip3
我得到了这个信息:

{"changed": false, "msg": "Unable to find any of pip3 to use.  pip needs to be installed."}

首先是ansible文件中规定的pip ansible模块的要求, 文档链接:

  • 皮普
  • 虚拟的
  • 设置工具
其次,您在可执行文件字段中提到了pip3,这使得它可以使用python3,并且可能主机上没有安装python3,而python2是可用的


因此,要么离开该字段,要么检查已安装的正确python版本,并相应地更新可执行字段的值。

您需要安装
pip3
,这与
pip
不同。 在ubuntu中,它附带了包
python3pip

sudo apt install python3-pip

在失败步骤之前安装Python3 pip

- name: install pip3
  apt: name=python3-pip state=present 

远程测试主机上是否安装了
pip
?@xenlo Yes I installed pip如果指定pip3可执行文件的完整路径,行为是否相同?例如,
/usr/bin/pip3
/usr/local/bin/pip3
?不,它没有提到依赖性,甚至没有提到如何在第一个位置设置它。@FelipeValdes,请检查答案中共享的链接,我发现在刚刚安装Python3PIP之后,我在ubuntu 18.04上的新安装中得到了这个。如果我再跑一次,效果很好。我不知道怎么修理。