安装MySQL_python 1.2.2时出现GCC错误(Mac OS 10.6 Snow Leopard) [英] GCC error when installing MySQL_python 1.2.2 (Mac OS 10.6 Snow Leopard)

查看:155
本文介绍了安装MySQL_python 1.2.2时出现GCC错误(Mac OS 10.6 Snow Leopard)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Snow Leopard上安装MySQL_python 1.2.2(我特别需要这个版本,而不是当前的1.2.3),并且在下面得到这个错误。



安装命令:

  pip install -Iv http://sourceforge.net/projects/mysql-python/files/ mysql-python / 1.2.2 / MySQL-python-1.2.2.tar.gz / download 

还有一部分跟踪:

 复制MySQLdb /常量/ CLIENT.py  - > build / lib.macosx-10.6-universal-2.6 / MySQLdb /常量

正在运行build_ext

建立'_mysql'扩展

创建构建/临时.macosx-10.6-universal-2.6

/usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info =(1,2,2,'final',0) - D__version __ = 1.2.2 -I / usr / local / mysql / 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 -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT - DDONT_DECLARE_CXA_PURE_VIRTUAL

从_mysql.c包含的文件中:35:

/usr/local/mysql/include/my_config.h:1053:1:warning:HAVE_WCSCOLLredefined

从/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8包含的文件中,pymem中的

compat.h:10,
$ b $ from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/ pyconfig.h:803:1:warning:这是以前定义的位置

在/usr/local/mysql/include/mysql.h:47包含的文件中,
$来自_mysql.c的b $ b:40:

/usr/include/sys/types.h:92:错误:重复的'unsigned'

/ usr / include / sys / types.h:92:错误:声明说明符中有两个或多个数据类型

错误:命令'/usr/bin/gcc-4.2'失败,退出状态1

有没有人看过这个错误?

解决方案 div>

快速谷歌搜索取得了这个答案


为了让mysqldb在leopard上工作,我发现我必须编辑_mysql.c并编辑行:

  #ifndef uint 
#define uin t unsigned int
#endif

我还必须编辑site.cfg并将threadsafe标记为False。



完成此操作后,我设法安装MySQLdb,太棒了!不是很快
,还有另一个问题:
$ b $ p引用自:... / _ mysql.so原因:找不到图像$ / b>

解决方案:

pre $ sudo ln -s / usr / local / mysql / lib / / usr / local / mysql / lib / mysql



I'm trying to install MySQL_python 1.2.2 (I specifically need this version, not the current 1.2.3) on Snow Leopard, and getting this error below.

Command to install:

pip install -Iv http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download

And a portion of the trace:

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

running build_ext

building '_mysql' extension

creating build/temp.macosx-10.6-universal-2.6

/usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,2,'final',0) - D__version__=1.2.2 -I/usr/local/mysql/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 -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL

In file included from _mysql.c:35:

/usr/local/mysql/include/my_config.h:1053: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 /usr/local/mysql/include/mysql.h:47,

             from _mysql.c:40:

/usr/include/sys/types.h:92: error: duplicate ‘unsigned’

/usr/include/sys/types.h:92: error: two or more data types in declaration specifiers

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

Has anyone seen this error before?

解决方案

A quick google search yielded this answer:

To get mysqldb working on leopard I found I had to edit _mysql.c and edit out the lines:

#ifndef uint
#define uint unsigned int
#endif     

I also had to edit site.cfg and mark threadsafe to False.

After doing this, I managed to get MySQLdb to install, great! Not so fast, there was yet another problem:

Referenced from: .../_mysql.so Reason: image not found

The solution:

sudo ln -s /usr/local/mysql/lib/ /usr/local/mysql/lib/mysql

这篇关于安装MySQL_python 1.2.2时出现GCC错误(Mac OS 10.6 Snow Leopard)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆