【发布时间】:2021-06-08 22:36:32
【问题描述】:
我使用 Ansible 2.9 通过 Amazon Linux 2 创建 EC2 实例。出于某些目的,我需要 EC2 上的 Python3。
所以我使用选项ansible_python_interpreter: "/usr/bin/python3"
但是使用这个选项模块 yum 返回错误pkg_mgr: yum msg: The Python 2 bindings for rpm are needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.
但 Amazon Lunux 2 不适用于 dnf。
Ansible error: "The Python 2 bindings for rpm are needed for this module" 和其他论坛中描述了相同的问题。到处都建议的解决方案是 Python2。
有什么方法可以使用 Python3 和 yum 吗?还是唯一的方法是使用 shell 模块?
【问题讨论】:
-
yum 尚未移植到 python 3。您必须使用 python 2。
标签: python amazon-web-services ansible amazon-linux-2