关于python:Ansible角色/包 – Ansible Galaxy – 安装MAC OSX时出错

Ansible roles/packages - Ansible Galaxy - error on installation MAC OSX

我正在尝试通过cli在mac os x el capitan上安装可应答的gaxy角色

1
$ ansible-galaxy install -r requirements.yml

我得到这个错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ERROR! Unexpected Exception: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('setuptools>=11.3'))
the full traceback was:

Traceback (most recent call last):
  File"/usr/local/bin/ansible-galaxy", line 73, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File"/Library/Python/2.7/site-packages/ansible/cli/galaxy.py", line 38, in <module>
    from ansible.galaxy.role import GalaxyRole
  File"/Library/Python/2.7/site-packages/ansible/galaxy/role.py", line 35, in <module>
    from ansible.playbook.role.requirement import RoleRequirement
  File"/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 25, in <module>
    from ansible.playbook.play import Play
  File"/Library/Python/2.7/site-packages/ansible/playbook/play.py", line 27, in <module>
    from ansible.playbook.base import Base
  File"/Library/Python/2.7/site-packages/ansible/playbook/base.py", line 35, in <module>
    from ansible.parsing.dataloader import DataLoader
  File"/Library/Python/2.7/site-packages/ansible/parsing/dataloader.py", line 32, in <module>
    from ansible.parsing.vault import VaultLib
  File"/Library/Python/2.7/site-packages/ansible/parsing/vault/__init__.py", line 67, in <module>
    from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
  File"/Library/Python/2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module>
    from cryptography.hazmat.backends.interfaces import HashBackend
  File"/Library/Python/2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2797, in <module>
    parse_requirements(__requires__), Environment()
  File"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 580, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
VersionConflict: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('setuptools>=11.3'))


运行以下命令升级python用户下的安装工具:

1
pip install --upgrade setuptools --user python

出于某种原因,在OSX中安装东西的方式(在我的例子中,在Docker容器中的Centos7下),安装工具包在正确的用户下安装不正确。