Monday, March 24, 2014

Installing different version of python on Fedora / Centos

Objective

We need a specific version of python other that the default version install by the OS. For instance Centos 5.8 comes with python version 2.4.3. Under no circumstance we should replace the python version the OS requires. Bad things will happen.

Current Installation


#python
Python 2.4.3 (#1, Jun 18 2012, 08:55:23)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg', '/usr/lib/python2.4/site-packages/chardet-1.0.1-py2.4.egg', '/usr/lib/python2.4/site-packages/autobahntestsuite-0.6.1-py2.4.egg', '/usr/lib/python2.4/site-packages/klein-0.2.3-py2.4.egg', '/usr/lib/python2.4/site-packages/Jinja2-2.7.2-py2.4.egg', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/Numeric', '/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages']


Installation in a different location


python2.7
http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xvf Python-2.7.2.tgz
cd Python-2.7.2
./configure
make
make altinstall


Check path

 
#python2.7
>>> import sys
>>> print sys.path
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']
>>>





No comments:

Post a Comment