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


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.


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


directory. I searched net and tried everything. i also installed all


and tried again but no success. Now on every try it says that zlib installed nothing to do.(when i try it from yum).

any help or idea will be highly appreciated.


Make sure that your python2.6 installation is compiled with zlib support.

  • i already compiled it and deleted the extracted folder and .tar file too month ago. now how can i re-compile it for this zlib ?? – Astha Oct 29 '11 at 11:50
  • Exactly the same way you did it the first time. – Ignacio Vazquez-Abrams Oct 29 '11 at 11:51
  • Try with this for example: ./configure --with-zlib=/usr/include --prefix=/your/prefix/choice To be able to compile python with zlib support, you must have zlib-devel installed...from what you have wrote, you installed the zlib-devel package after configure/compile python2.6. So you need to recompile. – gryzli Oct 29 '11 at 11:53
  • it is saying configure: WARNING: unrecognized options: --with-zlib – Astha Oct 29 '11 at 12:09
  • i tried doing wget python.org/ftp/python/2.6.6/Python-2.6.6.tgz tar -zxvf Python-2.6.6.tgz cd Python-2.6.6 ./configure --with-zlib=/usr/include – Astha Oct 29 '11 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.