ImportError: No Module named yaml | Ansible

后端 未结 7 1945
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 13:30

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 co

相关标签:
7条回答
  • 2021-01-01 14:00

    For python 3.6 you can install it with

    pip3 install pyyaml
    

    if there is a problem in importing, do

    pip3 uninstall pyyaml
    

    and then install it again:

    pip3 install pyyaml
    
    0 讨论(0)
  • 2021-01-01 14:01

    Had the same issue. Got past it using @FranMowinckel's answer.

    First I typed:

    pip --version 
    

    it outputted python 3. But, when I tried:

    sudo python -m pip install pyyaml
    

    I got an error saying:

    Error: No module named pip

    So, finally running:

    sudo easy_install pip
    

    everything worked fine. Go back and run:

    sudo python -m pip install pyyaml
    

    (you may have to run this with all the other modules as well) Now you should finally be able to run your initial command which failed.

    0 讨论(0)
  • 2021-01-01 14:06

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

    sudo pip install pyyaml
    
    0 讨论(0)
  • 2021-01-01 14:14

    This should work:

    sudo pip install pyyaml    
    
    0 讨论(0)
  • 2021-01-01 14:14

    Try this

    pip install ruamel.yaml
    
    0 讨论(0)
  • 2021-01-01 14:24

    @bigdata2's answer is correct but it might also happen that there's a conflict with python 3. So, check pip version (pip --version) and if it outputs python 3 then:

    sudo python -m pip install pyyaml
    

    So it gets installed for the same version as python.

    0 讨论(0)
提交回复
热议问题