使 RPM Ansible 失败并出现 Python 错误

Make RPM Ansible fails with Python error

我正在尝试在装有 RHEL 7.2 的机器上安装 Ansible 以创建 Ansible 服务器。

我需要 Ansible v2.4 或更新版本,为此我执行了以下步骤:

 1. yum -y install git asciidoc rpm-build python2-devel
 2. cd /usr/src
 3. git clone git://github.com/ansible/ansible.git --recursive
 4. cd ansible
 5. git checkout stable-2.4

现在一切正常,但现在我想运行这个命令:

make rpm 之后:yum install rpm-build/ansible-2.4-0.git201601051704.a2a786e.stable201.el7.centos.noarch.rpm

但是当我运行宁make rpm时,我收到以下错误:

Traceback (most recent call last):
  File "packaging/release/versionhelper/version_helper.py", line 9, in <module>
    from packaging.version import Version, VERSION_PATTERN
ImportError: No module named packaging.version
Makefile:39: *** "version_helper failed".  Stop.

我刚刚找到了我的问题的解决方案:

运行 pip install packaging

解决 CentOS 7 上的这个错误

首先你需要通过运行ning安装pip:

yum -y install python-pip 

然后清除错误,运行:

pip install packaging

如果是 rhel7,请执行以下步骤: