gpt4 book ai didi

python - ansible 在 OSX 上找不到 pycurl

转载 作者:太空宇宙 更新时间:2023-11-03 17:58:25 24 4
gpt4 key购买 nike

我刚刚开始使用 ansible,我正在尝试让它与 OSX Yosemite 的 linode 模块一起使用。我正在使用brew安装的Python和pip安装的ansible。所以我做了以下事情:

$ brew install python
$ PYCURL_SSL_LIBRARY=nss pip install pycurl
$ CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install ansible

测试:

$ which python
/usr/local/bin/python

$ python --version
Python 2.7.9

$ which ansible
/usr/local/bin/ansible

$ ansible --version
ansible 1.8.2
configured module search path = None

当我运行我的剧本时,我得到:

failed=True msg='pycurl required for this module'

所以不知怎的,ansible没有看到pycurl库。

这是剧本:

---
- hosts: 127.0.0.1
connection: local
gather_facts: no

tasks:
- name: "provision a server"
local_action:
module: linode
api_key: FOO
name: linode-test1
plan: 1
datacenter: 1
distribution: 99
password: 'superSecureRootPassword'
ssh_pub_key: ssh-rsa FOO
swap: 768
wait: yes
wait_timeout: 600
state: present

最佳答案

ubuntu上也出现这种情况,终于找到解决办法了。您需要显式传递 python 可执行文件的路径

更改 Ansible 主机文件

[local]
localhost

[local]
localhost ansible_python_interpreter=/usr/local/bin/python

或者你的虚拟环境python路径。

关于python - ansible 在 OSX 上找不到 pycurl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28126913/

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