1、下载
可从 进行下载wget
2、解压
tar jxvf Python-2.7.3.tar.bz23.进入目录安装:
./configure --prefix=/usr/local --enable-shared make make install当出现 libpython2.7.so.1.0的错误时:
[root@centos bin]# ./python ./python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory [root@centos bin]# pwd /usr/local/bin [root@centos bin]# /usr/local/bin/python2.7 /usr/local/bin/python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory [root@centos bin]# pwd /usr/local/bin
/usr/local/lib
libpython2.7.so.1.0的错误时的 解决办法:
(2) vi /etc/ld.so.conf 添加/usr/local/lib/sbin/ldconfig
/sbin/ldconfig -v参考:
(3) 使用新安装的python:
mv /usr/bin/python /usr/bin/python.bak ln -s /usr/local/bin/python2.7 /usr/bin/python(4)因为yum默认的是使用python2.4,为了使yum命令能正确执行,需要修改
[root@centos bin]# vi yum 将#!/usr/bin/python 改为 #!/usr/bin/python2.4