源码升级python3.5

2026-04-01 10:25:45

1、centos6.5 python默认版本为2.6.6

源码升级python3.5

2、使用yum安装依赖包

yum -y install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel

源码升级python3.5

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

源码升级python3.5

源码升级python3.5

源码升级python3.5

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

源码升级python3.5

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

/usr/local/lib

include ld.so.conf.d/*.conf

源码升级python3.5

6、然后执行 

/sbin/ldconfig

python -V

源码升级python3.5

7、yum无法使用新版python,修改yum使用的版本

vim /usr/bin/yum

#!/usr/bin/python2.6.6

源码升级python3.5

相关推荐
  • 阅读量:20
  • 阅读量:67
  • 阅读量:114
  • 阅读量:27
  • 阅读量:29
  • 猜你喜欢