安装 MySQL_python 1.2.2 (Mac OS 10.6 Snow Leopard) 时出现 GCC 错误

发布于 2024-10-20 18:45:08 字数 1755 浏览 1 评论 0原文

我正在尝试在 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

以及跟踪的一部分:

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

以前有人见过这个错误吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风蛊 2024-10-27 18:45:08

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

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

<前><代码>#ifndef uint
#定义 uint 无符号整型
#endif

我还必须编辑 site.cfg 并将线程安全标记为 False。

完成此操作后,我成功安装了 MySQLdb,太棒了!并非如此
很快,还有一个问题:

引用自:.../_mysql.so 原因:找不到图像

解决办法:

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

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
莳間冲淡了誓言ζ 2024-10-27 18:45:08

正如错误所说,事情已经被重新定义。我过去通过注释掉正在构建的库的源代码中的违规声明来解决这个问题。然而,该解决方案有一些明显的问题......

As the error says, things have been redefined. I've gotten around this in the past by commenting out the offending declarations in the source of the library being build. That solution however has some obvious problems...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文