Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

macos - Getting "ImportError: No Module named yaml" error

Computer: MacBook Pro mid 2012, running El Capitan 10.11.4

Python version 2.7.10

I've been trying to install ansible from source, and I've run these two commands (following the steps on ansibles documentation):

git clone git://github.com/ansible/ansible.git --recursive
cd ./ansible

and then ran this

source ./hacking/env-setup

I've also already installed these packages

sudo pip install paramiko PyYAML Jinja2 httplib2 six

However, if I try and run ansible by typing it in the terminal, I get the following error.

Traceback (most recent call last):
File "/Users/[myusr]/rock/ansible/bin/ansible", line 81, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/Users/[myusr]/rock/ansible/lib/ansible/cli/__init__.py", line 27, in <module>
import yaml
ImportError: No module named yaml

What should be done here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Do you have yaml module installed? If not, try installing yaml using the following command:

sudo pip install pyyaml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...