安装依赖
yum install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel -y
下载源码:wget -c https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
备份Python2的环境
mv /usr/bin/python /usr/bin/python_bak
编译安装3:
tar zxvf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/python3 --enable-shared --enable-loadable-sqlite-extensions --with-zlib
make
make install
添加软连接
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python
添加链接库
vi /etc/ld.so.conf
添加/usr/local/python3/lib/
让链接库生效
/sbin/ldconfig
更改以下文件头 #!/usr/bin/python 改为 #!/usr/bin/python_bak
/usr/bin/yum
/usr/libexec/urlgrabber-ext-down
/usr/bin/yum-config-manager
/usr/bin/yum-debug-restore
/usr/bin/yum-groups-manager
/usr/bin/yum-builddep
/usr/bin/yum-debug-dump
/usr/bin/yumdownloader
/usr/bin/gnome-tweak-tool
网友评论