2011-03-08 140 views
0

我想在Snow Leopard上安装MySQL_python 1.2.2(我特别需要这个版本,而不是当前的1.2.3),并且得到这个错误下面。安装MySQL_python 1.2.2时出现GCC错误(Mac OS 10.6 Snow Leopard)

命令来安装:

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

以及跟踪的一部分:

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 

有没有人见过这个错误?

回答

2

快速谷歌搜索产生this answer

为了得到MySQLdb的上豹纹的工作,我发现我不得不编辑_mysql.c和编辑了线:

#ifndef uint 
#define uint unsigned int 
#endif  

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

这样做后,我设法让MySQLdb安装,太棒了!没有这么快 ,还有另外一个问题:

从参考:.../_ mysql.so原因:没有找到图片

解决办法:

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

对于未来的搜索,我只需要从此链接开始迈出第一步(注释掉_mysql.so中的三行)。 – Joe 2011-03-08 22:45:13

+1

实际上没有必要这样做。只需安装python-dev和libmysqlclient,然后安装MySQL-python。 – noel 2012-10-22 21:32:07

+0

@shakabra:你没有读过这个问题的第一句话,是吗? – 2015-11-13 23:07:11

0

正如错误所说,事情已被重新定义。过去我通过评论正在构建的库的来源中的违规声明来解决这个问题。但是,这种解决方案有一些明显的问题......

相关问题