Wednesday, August 10, 2016

Installing Python3.5 on CENTOS 6.8

hi all,

I would like to list down all the steps to do a upgrade for python 3.5 on CENTOS6.8.

1. Installing the prerequisite package to build python from source

yum -y groupinstall "Development tools"


yum -y 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 python source.


tar xvfz Python-3.5.*.tgz

cd Python-3.5.*

3. Compiling the python from source


./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

make && make altinstall

ln -s /usr/local/bin/python3.5 /usr/bin/python3.5

4. Download and install the pip 



python3.5 get-pip.py

ln -s /usr/local/bin/pip /usr/bin/pip  

5. Voila, you have python3.5 ready.

[root@ip-172-31-18-184 ec2-user]# python3.5
Python 3.5.2 (default, Aug 10 2016, 23:27:34)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

6. Pip is ready too

[root@ip-172-31-18-184 ec2-user]# pip --version
pip 8.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)

Hope it helps.

2 comments:

sanuj said...

Thank you so much. You have aggregated the easiest method to setup python3.5 on linux

Anonymous said...

Thanks for posting this.