yum install-y zlib zlib-devel yum install-y openssl openssl-devel
源代碼編譯安裝pypython
#編譯安裝python2.7 mkdir -p /usr/local/src/python_src cd /usr/local/src/python_src wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2 tar -xf Python-2.7.5.tar.bz2 cd Python-2.7.5 ./configure --prefix=/usr/local/python2.7 make && make install echo "PATH=/usr/local/python2.7/bin:$PATH" >> /etc/profile source /etc/profile #查看python版本 python -v 返回Python 2.7.5
編譯安裝setuptoolsvim
mkdir -p /usr/local/src/python_src cd /usr/local/src/python_src wget https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz#md5=13951be6711438073fbe50843e7f141f --no-check-certificate tar -xf setuptools-1.4.2.tar.gz cd setuptools-1.4.2 python setup.py install
編譯安裝pipcentos
mkdir -p /usr/local/src/python_src cd /usr/local/src/python_src wget https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz --no-check-certificate tar -xf pip-1.4.1.tar.gz cd pip-1.4.1 python setup.py install
注意:bash
必須安裝setuptools。不然運行這步的時候報告python2.7
ImportError: No module named setuptoolside
#查看pip版本spa
pip --version
#運行pip模塊查看orm
# pip list pip (1.4.1) setuptools (1.4.2) wsgiref (0.1.2)
#建立一個python的連接ip
ln -sf /usr/local/python2.7/bin/python /usr/bin/python
然後修改yum裏面的python2.6md5
vim /usr/bin/yum
第一行改成
#!/usr/bin/python2.6
最後執行
pip install paramiko PyYAML jinja2 httplib2 -i http://e.pypi.python.org/simple pip install ansible -i http://e.pypi.python.org/simple
安裝上去的是1.4.3
# ansible --version ansible 1.4.3