源码升级python3.5
1、centos6.5 python默认版本为2.6.6

2、使用yum安装依赖包
yum -y install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel

3、下载python3.5源码包
wget http://mirrors.sohu.com/python/3.5.2/Python-3.5.2.tar.xz
解压
tar -xf Python-3.5.2.tar.xz
cd Python-3.5.2
编译安装
./configure --enable-shared --enable-loadable-sqlite-extensions --with-zlib
make && make install



4、备份旧版本,使用新版本
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python3 /usr/bin/python
python –V
报错 python: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

5、vim /etc/ld.so.conf 加入一行"/usr/local/lib"
/usr/local/lib
include ld.so.conf.d/*.conf

6、然后执行
/sbin/ldconfig
python -V

7、yum无法使用新版python,修改yum使用的版本
vim /usr/bin/yum
#!/usr/bin/python2.6.6
