[Tutor] Windows, mysql python

David Metzler dpm@softdesigns.com
Wed, 3 Jan 2001 22:29:31 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0038_01C075D4.A480E0C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I found the following archive MySQL-python-0.3.0-win32-2.zip on =
http://home.t-online.de/home/err666/
 My goal is to get mysql support into my windows Python 2.0 and connect =
to a remote Linux server running the most current Mysql .

I have installed the windows version of python 2.0

I put c:\python in my windows path

C:\ >Cd \pymysql  (this is where I unzipped the above archive)

C:\pymysql> Python setup.py

 I get an error about distutils.core not being available.

 Could you tell me how to get distutils and make it available?

The source of install.py implies that I have mysql loaded on the windows =
machine and is linking against it. I want connect to the mysql on a =
remote linux box perhaps on another network (but both computers are =
connected via the internet). Can I make this work? How?
The install.py in the above archive starts like this:

#!/usr/bin/env python

=20

"""Setup script for the MySQLdb module distribution."""

=20

import os, sys

from distutils.core import setup

from distutils.extension import Extension

=20

YES =3D 1

NO =3D 0

=20

# set this to 1 if you have the thread-safe mysqlclient library

thread_safe_library =3D NO

=20

# You probably don't have to do anything past this point. If you

# do, please mail me the configuration for your platform. Don't

# forget to include the value of sys.platform and os.name.

=20

mysqlclient =3D thread_safe_library and "mysqlclient_r" or "mysqlclient"

=20

if sys.platform =3D=3D "linux-i386": # Red Hat

    include_dirs =3D ['/usr/include/mysql']

    library_dirs =3D ['/usr/lib/mysql']

    libraries =3D [mysqlclient, "z"]

    runtime_library_dirs =3D []

    extra_objects =3D []

elif sys.platform =3D=3D "win32":

    include_dirs =3D [r'd:\MySQL\include']

    library_dirs =3D [r'd:\MySQL\lib\opt']

    libraries =3D [mysqlclient, 'zlib', 'msvcrt', 'libcmt',

                 'wsock32', 'advapi32']

    runtime_library_dirs =3D []

    extra_objects =3D [r'd:\MySQL\lib\opt\mysqlclient.lib']

elif os.name =3D=3D "posix": # most Linux/UNIX platforms

    include_dirs =3D ['/usr/include/mysql']

    library_dirs =3D ['/usr/lib/mysql']

    # MySQL-3.23 seems to need libz

    libraries =3D [mysqlclient, "z"]

    # On some platorms, this can be used to find the shared libraries

    # at runtime, if they are in a non-standard location. Doesn't

    # work for Linux gcc.

    ## runtime_library_dirs =3D library_dirs

    runtime_library_dirs =3D []

    # This can be used on Linux to force use of static mysqlclient lib

    ## extra_objects =3D ['/usr/lib/mysql/libmysqlclient.a']

    extra_objects =3D []

else:

    raise "UnknownPlatform", "sys.platform=3D%s, os.name=3D%s" % \

          (sys.platform, os.name)

=20

=20


------=_NextPart_000_0038_01C075D4.A480E0C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>I<FONT face=3DArial size=3D2> found the following archive=20
MySQL-python-0.3.0-win32-2.zip on </FONT><A=20
href=3D"http://home.t-online.de/home/err666/"><FONT face=3DArial=20
size=3D2>http://home.t-online.de/home/err666/</FONT></A>
<P class=3DMsoNormal>&nbsp;My goal is to get mysql support into my =
windows Python=20
2.0 and connect to a remote Linux server running the most current Mysql =
.</P>
<P class=3DMsoNormal>I have installed the windows version of python =
2.0</P>
<P class=3DMsoNormal>I put c:\python in my windows path</P>
<P class=3DMsoNormal>C:\ &gt;Cd \pymysql<SPAN style=3D"mso-spacerun: =
yes">&nbsp;=20
</SPAN>(this is where I unzipped the above archive)</P>
<P class=3DMsoNormal>C:\pymysql&gt; Python setup.py</P>
<P class=3DMsoNormal>&nbsp;I get an error about distutils.core not being =

available.</P>
<P class=3DMsoNormal>&nbsp;Could you tell me how to get distutils and =
make it=20
available?</P>
<DIV class=3DMsoNormal style=3D"mso-list: l0 level1 lfo1; tab-stops: =
list .5in">The=20
source of install.py implies that I have mysql loaded on the windows =
machine and=20
is linking against it. I want connect to the mysql on a remote linux box =
perhaps=20
on another network (but both computers are connected via the internet). =
Can I=20
make this work? How?</DIV>
<P class=3DMsoNormal>The install.py in the above archive starts like =
this:</P>
<P class=3DMsoNormal><SPAN=20
style=3D"mso-fareast-font-family: 'MS Mincho'">#!/usr/bin/env=20
python<?xml:namespace prefix =3D o ns =3D =
"urn:schemas-microsoft-com:office:office"=20
/><o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS Mincho'">"""Setup script for the =
MySQLdb=20
module distribution."""<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">import=20
os, sys<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">from=20
distutils.core import setup<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">from=20
distutils.extension import Extension<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">YES =3D=20
1<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">NO =3D=20
0<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"># set=20
this to 1 if you have the thread-safe mysqlclient =
library<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS Mincho'">thread_safe_library =3D=20
NO<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"># You=20
probably don't have to do anything past this point. If =
you<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"># do,=20
please mail me the configuration for your platform. =
Don't<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">#=20
forget to include the value of sys.platform and =
os.name.<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS Mincho'">mysqlclient =3D =
thread_safe_library=20
and "mysqlclient_r" or "mysqlclient"<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">if=20
sys.platform =3D=3D "linux-i386": # Red Hat<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>include_dirs =3D=20
['/usr/include/mysql']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>library_dirs =3D=20
['/usr/lib/mysql']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>libraries =3D =
[mysqlclient,=20
"z"]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; =
</SPAN>runtime_library_dirs =3D=20
[]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>extra_objects =3D=20
[]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">elif=20
sys.platform =3D=3D "win32":<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>include_dirs =3D=20
[r'd:\MySQL\include']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>library_dirs =3D=20
[r'd:\MySQL\lib\opt']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>libraries =3D =
[mysqlclient,=20
'zlib', 'msvcrt', 'libcmt',<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
</SPAN>'wsock32', 'advapi32']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; =
</SPAN>runtime_library_dirs =3D=20
[]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>extra_objects =3D=20
[r'd:\MySQL\lib\opt\mysqlclient.lib']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'">elif=20
os.name =3D=3D "posix": # most Linux/UNIX =
platforms<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>include_dirs =3D=20
['/usr/include/mysql']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>library_dirs =3D=20
['/usr/lib/mysql']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN># MySQL-3.23 seems =
to need=20
libz<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>libraries =3D =
[mysqlclient,=20
"z"]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN># On some =
platorms, this can=20
be used to find the shared libraries<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN># at runtime, if =
they are in=20
a non-standard location. Doesn't<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN># work for Linux=20
gcc.<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>## =
runtime_library_dirs =3D=20
library_dirs<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; =
</SPAN>runtime_library_dirs =3D=20
[]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN># This can be used =
on Linux=20
to force use of static mysqlclient lib<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>## extra_objects =
=3D=20
['/usr/lib/mysql/libmysqlclient.a']<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>extra_objects =3D=20
[]<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN=20
style=3D"mso-fareast-font-family: 'MS =
Mincho'">else:<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>raise =
"UnknownPlatform",=20
"sys.platform=3D%s, os.name=3D%s" % \<o:p></o:p></SPAN></P>
<P class=3DMsoPlainText><SPAN style=3D"mso-fareast-font-family: 'MS =
Mincho'"><SPAN=20
style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
</SPAN>(sys.platform, os.name)<o:p></o:p></SPAN></P>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV></BODY></HTML>

------=_NextPart_000_0038_01C075D4.A480E0C0--