Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

installing MySQL for Python 1

Status
Not open for further replies.

mhamilton3

Programmer
Oct 31, 2001
129
Hello all,
I need to tie my python app to mysql. I have gone to sourceforge and downloaded the appropriate .tar.gz file, I have exploded the file and now how do I get Python to find it. I assume there is some setup script that needs a variable somewhere, but I am not sure where. If this helps, none of my other programs are compiled so neither are these.

I am doing this work on a FreeBSD machine if that helps clarify things. Thanks.

 
Yes I have read the README. None of the other Python code I have is compiles so I assumed I could just copy this stuff to the right place, point to it and all would be well. Can I compile and build this even though nothing else is?
 
One more note, I typed export ... and received an error indicating it did not know what export was.
 
From the README file:
Finally, putting it together:

$ tar xfz MySQL-python-1.0.0.tar.gz
$ cd MySQL-python-1.0.0
$ export mysqlversion="4.0.20"
$ export mysqlclient="mysqlclient_r"
$ export mysqloptlibs="ssl crypto"
$ python setup.py build
$ su
# python setup.py install

You do kinda need a to know a little bit about your shell. These instructions were written for a bourne derivative shell, like sh/ksh/bash. If you're using csh/tcsh/etc. then you'll have to convert the commands to use that syntax.
 
Thanks Eric, I did exactly as was requested and when running export, I got a message indicating it could not find export. Is export part of Python or MySQL or part of this package?
 
Your obviously new to unix, export is a function of the shell and not python, mysql or the package. What shell are you running in? echo $SHELL will probably reveal you're running a c-shell derivative. Try typing "bash" to get yourself into a shell that doesn't suck and run the procedure again.
 
THANK YOU Eric. I am not new to Unix, but very new to any kind of system administration. I will try this
 
One final question (I Hope). I ended up getting an error when running this install as follow:

/usr/libexec/elf/ld: cannot find -lmysqlclient_r

Is that because I need to use something other than mysqlclient_r. The README said I should use mysqlclient_r if I can because that is the best one, but it supports others as well.
 
I think it's possible you don't have the mysql-devel package loaded. Again, not a python or a package issue.

Just for kicks, you may want to try the 1.1.7 version. I've using it in production and it's very stable. Also, I didn't have to go through a lot of this configuration to build it.

You will still need the mysql development libraries. Try "locate libmysql" to see if there's anything installed somewhere.
 
This is what is returned when I do a locate:

Code:
/usr/local/lib/libmysqlclient.a
/usr/local/lib/libmysqlclient.so
/usr/local/lib/libmysqlclient.so.10
/usr/local/lib/mysql/libmysqlclient.a
/usr/local/lib/mysql/libmysqlclient.so
/usr/local/lib/mysql/libmysqlclient.so.10

I will go take a look at the 1.1.7 version. Thanks
 
You don't have the reentrant version of the mysql client libs. If your python isn't multi-threaded, that shouldn't be a problem, compile it single threaded. Otherwise you're going to have to figure out why.

 
Thank you very much Eric,

Changing the mysqlclient variable allowed me to finish the process. Life should be good form me. Again, thanks for all your knowledge.

- Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top