How do I install MySQLdb on a Python 2.6 source build, on Debian Lenny?

Posted by nbolton on Server Fault See other posts from Server Fault or by nbolton
Published on 2010-06-30T23:27:26Z Indexed on 2011/11/16 17:56 UTC
Read the original article Hit count: 153

Filed under:
|

I've installed Python 2.6 from source on my Debian Lenny server, as Lenny does not have the python2.6 package. So, my Python 2.5 has MySQLdb installed and working just fine because I installed the python-mysqldb package.

I figured I could just install MySQLdb from source, but because I have the Lenny python-dev package, it builds against 2.5:

# python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.5/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.5 -c _mysql.c -o build/temp.linux-x86_64-2.5/_mysql.o -DBIG_JOINS=1 -fPIC
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.5/_mysql.o -L/usr/lib/mysql -lmysqlclient_r -o build/lib.linux-x86_64-2.5/_mysql.so

I don't want to run python setup.py install, because I'm afraid it's going to screw up MySQLdb on 2.5 -- should I? I imagine it'd just overwrite 2.5 and do nothing to 2.6 -- maybe there's an argument I can use to install to 2.6? I imagine that I would need also to build against 2.6, so how do I do this?

© Server Fault or respective owner

Related posts about mysql

Related posts about python