I want to use MySQLDB to connect MySQL
but I got a problem.
the problem is:
---------------------------------------------------------------------------------
cs6201:/home/lamwaiman/python/data # python dm.py
Traceback (most recent call last):
File "dm.py", line 11, in <module>
import MySQLdb
File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
File "build/bdist.linux-i686/egg/_mysql.py", line 6, in __bootstrap__
ImportError: /root/.python-eggs/MySQL_python-1.2.3c1-py2.6-linux-i686.egg-tmp/_mysql.so: undefined symbol: __pure_virtual
----------------------------------------------------------------------------------
I've searched google, some people said this may because compiler mismatch between MySQL and Python, I checked:
--------------------------------------------------------------------------------
lamwaiman@cs6201:/usr/bin> strings -a mysql | grep -i gcc | uniq -d
GCC: (GNU) 4.2.1 (SUSE Linux)
lamwaiman@cs6201:/usr/bin> strings -a python | grep -i gcc | uniq -d
GCC: (GNU) 4.2.1 (SUSE Linux)
lamwaiman@cs6201:/usr/bin>
---------------------------------------------------------------------------------
They got the same compiler. What is the problem?
My computer configuration:
OS: Linux 2.6.22.19-0.4-default i686
Current user: lamwaiman@cs6201
System: openSUSE 10.3 (i586)
KDE: 3.5.7 "release 72.11"
CPU: Intel(R) Pentium(R) D CPU 3.00GHz ( 2 core )
mysql Ver 14.12 Distrib 5.0.45, for suse-linux-gnu (i686) using readline 5.2
Python 2.6.4
the mysql, was installed by my computer-mate, I think he probably just installed it through YAST software management.
The python is installed by me, there is an python 2.4 installed in this OS already. I want to upgrade it to 2.6.4 , I downloaded the python 2.6.4 tar file, untar it, then >>python setup.py
----------------------------------------------------------------------------------
Let me tell you my installation step:
1)I try to use MySQLDB statement, it point out that I didn't install MySQLDB
2) I downloaded MySQLDB from sourceforge
3) I tried >> python setup.py build, it said I missing "setuptools"
4) I tried >> python ez_setup.py, everything is ok and this setuptools was installed.
5) I tried again, >> python setup.py build, this time it said I missing mysql_config
4) I searched on the Internet, people said it is because I missing a module called mysql_devel
5) I searched on the internet again, downloaded a "MySQL-devel-5.0.22-0.i386.rpm", clicked it and it was installed.
6) I installed it again >>python setup.py build, everything is ok.
7) following the README instruction, I >>sudo python setup.py install, everything is fine.
8) then I run my python program again, get the above problem now.
9) I removed the mysql-devel though YAST
10) In the YAST software management, I found out there is a "libmysqlclient-devel" with the same version of my MySQL(5.0.45.22) , I think this is also one of the"mysql-devel", installed it. Same result.
Anyone get any idea?? I don't know what do "compile from source" means, I am quite new to linux, usually I just follow the instruction.
Please tell me if you got any idea, thank you very much!!