1. CentOS Install Python dependency package
Yum Groupinstall "Development tools"
Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel Libpcap-devel Xz-devel
2, download the Python3.4 source package and compile
wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz
Tar XF python-3.4.1.tgz
CD Python-3.4.1
./configure--prefix=/usr/local--enable-shared
Make
Make install
3. You need to configure the library before running Python:
Echo/usr/local/lib >>/etc/ld.so.conf.d/local.conf
Ldconfig
4. Run the Demo:
Python3--version
Python 3.4.1
5. Delete the libraries needed to compile Python
Yum Groupremove "Development tools"--remove-leaves
Yum Remove Zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel L Ibpcap-devel Xz-devel--remove-leaves
6, establish a soft connection, so that the system default Python point to python3.4
mv/usr/bin/python/usr/bin/python2.6.6
Ln-s/usr/local/bin/python3.4/usr/bin/python
Reference: http://www.linuxidc.com/Linux/2015-01/111870.htm
CentOS Update python