无法安装MySQL-Python

时间:2011-06-02 14:37:07

标签: python mysql install

由于某种原因,我无法在我的virtualenv中安装MySQL-Python软件包,也无法在OS X上的主要Python安装中安装MySQL-Python软件包。我得到以下输出:

    Downloading/unpacking MySQL-Python
    Running setup.py egg_info for package MySQL-Python
    warning: no files found matching 'MANIFEST'
    warning: no files found matching 'ChangeLog'
    warning: no files found matching 'GPL'
    Installing collected packages: MySQL-Python
    Running setup.py install for MySQL-Python
    building '_mysql' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.5.10/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -g
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:39:1: warning: this is the location of the previous definition
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:619:1: warning: "SIZEOF_TIME_T" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:40:1: warning: this is the location of the previous definition
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
    /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:39:1: warning: this is the location of the previous definition
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:619:1: warning: "SIZEOF_TIME_T" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:40:1: warning: this is the location of the previous definition
    _mysql.c:2888: fatal error: error writing to -: Broken pipe
    compilation terminated.
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:33:1: warning: this is the location of the previous definition
    In file included from _mysql.c:36:
    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined
    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
                     from pymemcompat.h:10,
                     from _mysql.c:29:
    /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition
    lipo: can't open input file: /var/folders/8O/8OOqsN1GEkSD0wcAjZFbMk+++TI/-Tmp-//cc0nabTS.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/jmalina/Sites/virtualenvs/muckrack/bin/python -c "import setuptools;__file__='/Users/jmalina/Sites/virtualenvs/muckrack/build/MySQL-Python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/8O/8OOqsN1GEkSD0wcAjZFbMk+++TI/-Tmp-/pip-92IOBF-record/install-record.txt --install-headers /Users/jmalina/Sites/virtualenvs/muckrack/bin/../include/site/python2.6:
    running install

    running build

    running build_py

    copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb

    running build_ext

    building '_mysql' extension

    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.5.10/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -g

    In file included from _mysql.c:36:

    /usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

         /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:39:1: warning: this is the location of the previous definition

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:619:1: warning: "SIZEOF_TIME_T" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:40:1: warning: this is the location of the previous definition

    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed

    Installed assemblers are:

    /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

    /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:39:1: warning: this is the location of the previous definition

    In file included from _mysql.c:36: /usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:619:1: warning: "SIZEOF_TIME_T" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:40:1: warning: this is the location of the previous definition

    _mysql.c:2888: fatal error: error writing to -: Broken pipe

compilation terminated.

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:326:1: warning: "SIZEOF_SIZE_T" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:9,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pymacconfig.h:33:1: warning: this is the location of the previous definition

    In file included from _mysql.c:36:

/usr/local/Cellar/mysql/5.5.10/include/my_config.h:419:1: warning: "HAVE_WCSCOLL" redefined

    In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,

                 from pymemcompat.h:10,

                 from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1: warning: this is the location of the previous definition

    lipo: can't open input file: /var/folders/8O/8OOqsN1GEkSD0wcAjZFbMk+++TI/-Tmp-//cc0nabTS.out (No such file or directory)

    error: command 'gcc-4.2' failed with exit status 1

    ----------------------------------------
    Command /Users/jmalina/Sites/virtualenvs/muckrack/bin/python -c "import setuptools;__file__='/Users/jmalina/Sites/virtualenvs/muckrack/build/MySQL-Python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/8O/8OOqsN1GEkSD0wcAjZFbMk+++TI/-Tmp-/pip-92IOBF-record/install-record.txt --install-headers /Users/jmalina/Sites/virtualenvs/muckrack/bin/../include/site/python2.6 failed with error code 1

2 个答案:

答案 0 :(得分:3)

好像你已经安装了MySQL 5.5.10和Python 2.6。 从MySQL-3.23到5.0支持当前版本的MySQL-python(版本1.2.3)。 不过,您可以尝试通过ActivePython进行安装。

如果您将ActivePython安装到默认路径,请打开终端并运行:

/opt/ActivePython-2.6/bin/pypm install mysql-python

我的Fedora 15平台上有类似MySQL 5.5和Python 2.7的情况,对我来说效果很好。

答案 1 :(得分:0)

尝试重新加载整个包,并确保在与包相同的目录中执行命令。现在MySQL找不到必要的文件。