Search This Blog

Saturday, July 2, 2016

Set-up python 3.3 on centos 6.4

Preface:Older Linux releases usually don't include Python 3 in their repositories. They also rely heavily on Python 2. This means that installing Python 3 on an older CentOS is slightly more complicated. You don't realize it until you need it...

Due credit: When I started toying with Python 3.3 installation on one of my older CentOS machines, I ran into a post by O.S. Tezer at DigitalOcean . As Tezer focused on Python 2.7. I thought it might be useful for others to have a full python 3 howto. 

# Prepare the system for the compilation 
yum install -y zlib-devel openssl-devel sqlite-devel bzip2-devel xz-libs
# (xz-libs is for une unzipping of the source; a just-in-case installation)

# Get python source & compile 
wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz  
# pay attention where you do this so that you don't clutter your system 
#unzip 
xz -d Python-2.7.6.tar.xz 
#untar 
tar -xvf Python-2.7.6.tar 
cd Python-3.3.3 
#configuration 
./configure
#build 
make 
#install
sudo make altinstall #we really, but really, don't want to alter the system's older version python 
#   the python executables are created by deafult in /usr/local/bin 
#  you might wish to add to your path or the system's path the python3.3 executable 
#  (/etc/profile.d  and/or $HOME/.bash_profile )

# Setting Up pip and virtualenv
# how to set setuptools 23.0.0
 https://pypi.python.org/pypi/setuptools
# (the no check certificate and insecure switches are required because of the ancient o/s )
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
sudo /usr/local/python3.3 ez_setup.py --insecure
#now lets get pip and install it 
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py 
sudo /usr/local/bin/python3.3  get-pip.py
# at last we are at python's own land...
sudo /usr/local/bin/pip3  install virtualenv 





No comments:

Post a Comment