网上查了最简单的安装步骤:
1. 下载python2.7.5,保存到 /data/qtongmon/software
http://www.python.org/ftp/python/
2. 解压文件
tar xvf Python-2.7.5.tar.bz2
3. 创建安装目录
mkdir /usr/local/python27
4. 安装python
./configure --prefix=/usr/local/python27
make
make install
5. 修改老版本的ln指向(注意:这里修改后,可能会影响yum的使用)
mv /usr/bin/python /usr/bin/python2.4.3
ln -s /usr/local/python27/bin/python /usr/bin/python
继续安装其他模块的时候,悲剧发生了:
... relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
... could not read symbols: Bad value
解决办法编译器已经提示了:recompile with -fPIC
该怎么带这个参数编译呢,原来是要重新编译python。
重新编译成功了!
但是新的问题又出现了:
libpython2.7.so.1.0: cannot open shared object file: No such file or directory
解决办法:
1. cp /usr/local/python27/lib/libpython2.7.so.1.0 /usr/local/lib
cd /usr/local/lib
ln -s libpython2.7.so.1.0 libpython2.7.so
2. 使用命令whereis libpython2.7.so.1.0得到如下结果就说明
libpython2.7.so.1: /usr/local/lib/libpython2.7.so.1.0
终于搞定!!!!