2011-03-08 162 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

正如錯誤所說,事情已被重新定義。過去我通過評論正在構建的庫的來源中的違規聲明來解決這個問題。但是,這種解決方案有一些明顯的問題......

相關問題