[svc][op]pip安装ansible && yum安装python34

相对yum安装,pip安装的好处是jinjia版本到了2.8

pip安装ansible

Successfully installed MarkupSafe-1.0 PyYAML-3.12 ansible-2.2.1.0 jinja2-2.8.1 paramiko-2.1.2 pyasn1-0.2.3 pycrypto-2.6.1

1,yum安装python3

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum install lrzsz ntpdate sysstat dos2unix wget telnet tree -y

yum install python34 python34-pip -y

1,centos7优化pip

yum install python-pip -y
cd
mkdir .pip
cd .pip
cat > pip.conf <<EOF [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com
EOF

2,centos7安装ansible依赖及ansible

yum install gcc libffi-devel python-devel openssl-devel -y
pip install cryptography
pip install ansible

# 使用pip升级固定的包:
pip install --upgrade 包名 如:
pip install --upgrade pip

如:jinja: https://pypi.python.org/pypi/Jinja2 下载地址
pip install Jinja2-2.9.5-py2.py3-none-any.whl

不安装依赖会报错

原文地址:https://www.cnblogs.com/iiiiher/p/6567451.html