Search code examples
pythoncentoszlibsetuptoolsmysql-python

python setuptools installation in centos


i have to install mysqldb module of python in my centos server. i have 2 versions of python

  1. 2.4.3 the default one
  2. 2.6 which i installed

i want to install mysqldb module for 2.6 version of the python. i installed it from here but when i am on the line

python2.6 setup.py install

it says

Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup, Extension
ImportError: No module named setuptools

so i went for installing setup tools from here.using the command

setuptools-0.6c11-py2.6.egg

because i installed 2.6 python so i installed this rpm. but when i execute this command it says

Traceback (most recent call last):
File "<string>", line 1, in <module>
zipimport.ZipImportError: can't decompress data; zlib not available

but when i did locate command i do find the package and rpm installed for zlib.

/usr/share/doc/zlib-1.2.3
/usr/share/doc/zlib-1.2.3/README
/var/cache/yum/base/packages/zlib-devel-1.2.3-4.el5.x86_64.rpm

can any one please help me in this. I exactly want to install mysqldb module for python 2.6 i installed on my

/usr/local/bin/

directory.

any help or idea will be highly appreciated.


Solution

  • When you installed Python 2.6, you most likely didn't have zlib-devel installed, so your Python doesn't have that feature built in. I recommend that you install

    readline-devel
    sqlite-devel
    zlib-devel
    openssl-devel
    

    before compiling your own Python. After installing the newly compiled Python, fetch the setuptools source package and install it with:

    python2.6 setup.py install