急啊!我在安装MySQL-python-1.2.0时,遇到以下问题

急啊!我在安装MySQL-python-1.2.0时,遇到以下问题

我的机器的环境是:
solaris8
Mysql 5.0.19---ready
ActivePython 2.4.3.11---ready
GNUgcc 3.4.4---ready
我在安装MySQL-python-1.2.0时,遇到以下问题:
执行"python setup.py build",系统提示错误:
“python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
cc -DNDEBUG -O -xcode=pic32 -I/usr/local/mysql-standard-5.0.19-solaris8-sparc-64
bit/include -I/usr/local/ASpy24/include/python2.4 -c _mysql.c -o build/temp.sola
ris-2.8-sun4u-2.4/_mysql.o -I/usr/local/mysql-standard-5.0.19-solaris8-sparc-64b
it/include -xO3 -mt -D_FORTEC_ -xarch=v9
cc: warning: `-x arch=v9' after last input file has no effect
cc: language code=pic32 not recognized
cc: _mysql.c: linker input file unused because linking not done
cc -G build/temp.solaris-2.8-sun4u-2.4/_mysql.o -L/usr/local/mysql-standard-5.0.
19-solaris8-sparc-64bit/lib -lmysqlclient_r -lz -lpthread -lthread -lposix4 -lge
n -lsocket -lnsl -lm -lpthread -lthread -lmysqlclient_r -o build/lib.solaris-2.8
-sun4u-2.4/_mysql.so
cc: build/temp.solaris-2.8-sun4u-2.4/_mysql.o: No such file or directory
error: command 'cc' failed with exit status 1”
这是什么原因啊,求求大家帮帮忙啊,搞不定公司肯定会鄙视我的,我的mail是graflong@gmail.com
我自己顶一个,心如刀割啊
可以看下setup.py, site.cfg是如何进行编译的
之前我刚编过。改了配置用“threadsafe = False”。和你环境中的mysql有关
我不懂啊,这个是我setup.py的编译文件
import os
import sys
from distutils.core import setup
from distutils.extension import Extension

mysqlclient = os.getenv('mysqlclient', 'mysqlclient_r')
mysqlstatic = eval(os.getenv('mysqlstatic', 'False'))
embedded_server = (mysqlclient == 'mysqld')

name = "MySQL-%s" % os.path.basename(sys.executable)
if embedded_server:
    name = name + "-embedded"
version = "1.2.0"

extra_objects = []

if sys.platform == "win32":
    mysqlroot = os.getenv('mysqlroot', None)
    if mysqlroot is None:
        print "You need to set the environment variable mysqlroot!"
        print "This should be the path to your MySQL installation."
        print "Probably C:\Program Files\MySQL 4.1\ or something like that."
        sys.exit(1)

    include_dirs = [os.path.join(mysqlroot, "include")]
    library_dirs = [os.path.join(mysqlroot, "libs")]
    libraries = ['zlib', 'msvcrt', 'libcmt', 'wsock32', 'advapi32']
    if mysqlstatic:
        extra_objects.append(os.path.join(
            library_dirs[0], mysqlclient+'.lib'))
    else:
        libraries.append(mysqlclient)

else:

    def config(what):
        from os import popen
        return popen("mysql_config --%s" % what).read().strip().split()

    include_dirs = [ i[2:] for i in config('include') ]

    if mysqlclient == "mysqlclient":
        libs = config("libs")
    elif mysqlclient == "mysqlclient_r":
        libs = config("libs_r")
    elif mysqlclient == "mysqld":
        libs = config("embedded")
    library_dirs = [ i[2:] for i in libs if i.startswith("-L") ]
    libraries = [ i[2:] for i in libs if i.startswith("-l") ]

    # Workaround for a pre-4.1.9 bug
    if "z" not in libraries:
        libraries.append("z")

    extra_compile_args = config("cflags")

    if mysqlstatic:
        extra_objects.append(os.path.join(
            library_dirs[0],'lib%s.a' % mysqlclient))
    else:
        libraries.append(mysqlclient)

# avoid frightening noobs with warnings about missing directories
include_dirs = [ d for d in include_dirs if os.path.isdir(d) ]
library_dirs = [ d for d in library_dirs if os.path.isdir(d) ]

classifiers = """
Development Status :: 5 - Production/Stable
Environment :: Other Environment
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows :: Windows NT/2000
Operating System :: OS Independent
Operating System :: POSIX
Operating System :: POSIX :: Linux
Operating System :: Unix
Programming Language :: C
Programming Language :: Python
Topic :: Database
Topic :: Database :: Database Engines/Servers
"""

metadata = {
    'name': name,
    'version': version,
    'description': "Python interface to MySQL",
    'long_description': __doc__,
    'author': "Andy Dustman",
    'author_email': "andy@dustman.net",
    'license': "GPL",
    'platforms': "ALL",
    'url': "http://sourceforge.net/projects/mysql-python",
    'download_url': "http://prdownloads.sourceforge.net/mysql-python/" \
                    "MySQL-python-%s.tar.gz" % version,
    'classifiers': [ c for c in classifiers.split('\n') if c ],
    'py_modules': [
        "_mysql_exceptions",
        "MySQLdb.converters",
        "MySQLdb.connections",
        "MySQLdb.cursors",
        "MySQLdb.sets",
        "MySQLdb.times",
        "MySQLdb.stringtimes",
        "MySQLdb.mxdatetimes",
        "MySQLdb.pytimes",
        "MySQLdb.constants.CR",
        "MySQLdb.constants.FIELD_TYPE",
        "MySQLdb.constants.ER",
        "MySQLdb.constants.FLAG",
        "MySQLdb.constants.REFRESH",
        "MySQLdb.constants.CLIENT",
        ],
    'ext_modules': [
        Extension(
            name='_mysql',
            sources=['_mysql.c'],
            include_dirs=include_dirs,
            library_dirs=library_dirs,
            libraries=libraries,
            extra_compile_args=extra_compile_args,
            extra_objects=extra_objects,
            ),
        ],
    }

setup(**metadata)

还需要知道什么啊
Hi,

the key error is :

QUOTE:
cc: build/temp.solaris-2.8-sun4u-2.4/_mysql.o: No such file or directory

You should tell where is your mysql source packages.
Set your right paths to
    include_dirs=include_dirs,
    library_dirs=library_dirs,
Python-mysql  compiler requires mysql extensions!

[Copy to clipboard] [ - ]
CODE:
'ext_modules': [
        Extension(
            name='_mysql',
            sources=['_mysql.c'],
            include_dirs=include_dirs,
            library_dirs=library_dirs,
            libraries=libraries,
            extra_compile_args=extra_compile_args,
            extra_objects=extra_objects,
            ),
        ],

Best, ulmer
Thank you very much,I will try it immediately
错误和改之前一样
ext_mysql_metadata = dict(
   100      name="_mysql",
   101     #Apr.11  include_dirs=include_dirs,
   102      include_dirs=["/usr/local/mysql-standard-5.0.19-solaris8-sparc-64bit/include"],
   103     #Apr.11  library_dirs=library_dirs,
   104      library_dirs=["/usr/local/mysql-standard-5.0.19-solaris8-sparc-64bit/lib"],
   105      libraries=libraries,
   106      extra_compile_args=extra_compile_args,
   107      extra_objects=extra_objects,
   108      sources=['_mysql.c'],
   109      )


QUOTE:
原帖由 graflong 于 2006-4-11 17:45 发表
错误和改之前一样
ext_mysql_metadata = dict(
   100      name="_mysql",
   101     #Apr.11  include_dirs=include_dirs,
   102      include_dirs=["/usr/local/mysql-standard-5.0.19 ...

Have you read README under MySQL-python-1.2.0?
Try to reconfigurate site.cfg and put your mysql right here and don't
modify any setup.py

[Copy to clipboard] [ - ]
CODE:
site.cfg
...
[compiler]
#mysql_root: /usr/local/mysql
#library_dirs: %(mysql_root)s/lib
#include_dirs: %(mysql_root)s/include
#libraries: mysqlclient
...

Good luck, ulmer