Installing MySQLdb under Cygwin

Perflubron pih00 at doc.ic.ac.uk
Fri Oct 10 14:09:17 EDT 2003


Hi,

I'm having trouble installing MySQLdb 0.9.2 on the following Cygwin system:
- Python 2.2.2
- MySQL 3.23.57
- gcc 2.95.3-10

The steps I take are:
1. Modify setup.py
   - Set thread_safe_library = NO
   - Change the Cygwin paths to use /cygdrive/c/...
   - Change the library path to .../lib/opt

2. Run setup.py build 
   --> Errors on lines 2005-7 and 2094-6 of _mysql.c: 
       "Initializer element is not constant"

3. Replace the above lines with "0,"

4. Run setup.py build 
   --> Many undefined references to mysql functions

5. Change setup.py to use mysql library instead of mysqlclient

6. Run setup.py build 
   --> It compiles, so I run the setup.py install

7. When I try to import the library, I get the following error:
Traceback (most recent call last):
  File "./test.py", line 4, in ?
    import MySQLdb
  File "MySQLdb/__init__.py", line 27, in ?
    import _mysql
ImportError: dlopen: Win32 error 127

I'm stuck. I've tried using g++ instead of gcc, which gets rid of the 
Initializer element is not constant" error. But I end up at the same error 
when I try to import the module.

I have seen some posts from people who have managed to install MySQLdb on 
Cygwin - could someone please let me know how to do it?

Kind regards,

Per




More information about the Python-list mailing list