cd /data/tools

wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz

# tar xvzf Python-2.7.6.tgz

# cd Python-2.7.6

# ./configure --prefix=/usr/local --enable-shared

# make && make install



安装了python2.7,第一次执行时报错:

error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory


解决方法如下:

find / -name libpython2.7.so.1.0

vi /etc/ld.so.conf 

添加上python2.7的lib库地址,如我的/usr/local/lib,保存文件

 /sbin/ldconfig -v


#mv /usr/bin/python /usr/bin/python2.6.6  

#ln -s /usr/local/bin/python2.7 /usr/bin/python  

python -V 

vi /usr/bin/yum  

将文件头部的
#!/usr/bin/python

改成
#!/usr/bin/python2.6.6