zabbix:/root# python -V
Python 2.6.6
zabbix:/root# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named redis
下载python 2.7.3
Python-2.7.3.tgz
4.安装
tar -xzvf python-2.7.5.tar.gz
cd python-2.7.5
./configure --prefix=/usr/local/python27 #此一步务必记住不要覆盖掉centos6.4自带的python26,指定一个新的安装路径
make && make install
更改系统默认python指向
mv /usr/bin/python /usr/bin/python2.6.6.old #备份自带python26
ln -s /usr/local/python27/bin/python2.7 /usr/bin/python # 将系统默认python指向新安装的python27
node2:/root#ln -s /usr/local/python27/bin/python2.7 /usr/bin/python
node2:/root#python -V