2012-06-12 39 views
1

剛剛安裝了XCode 4.3,現在無法安裝mysql-python軟件包。我使用的OS X Lion 10.7.4,XCode 4.3,自制軟件,都是在幾個小時前安裝的。使用homebrew'ed蟒蛇2.7.3,MySQL的5.5.25無法使用XCode 4.3編譯mysql-python 4.3/homebrew

這裏是輸出:

(lukasz) ~ > pip install 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 
/usr/bin/gcc-4.2 -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.5.25/include -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c _mysql.c -o build/temp.macosx-10.4-x86_64-2.7/_mysql.o -Qunused-arguments -g 
_mysql.c:1: error: bad value (native) for -march= switch 
_mysql.c:1: error: bad value (native) for -mtune= switch 
error: command '/usr/bin/gcc-4.2' failed with exit status 1 
Complete output from command /usr/local/Cellar/python/2.7.3/bin/python -c "import setuptools;__file__='/Users/lukasz/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/lv/p8rbhkk559x1337twh8flq0r0000gn/T/pip-Bvu67T-record/install-record.txt: 
running install 

running build 

running build_py 

copying MySQLdb/release.py -> build/lib.macosx-10.4-x86_64-2.7/MySQLdb 

running build_ext 

building '_mysql' extension 

/usr/bin/gcc-4.2 -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/5.5.25/include -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c _mysql.c -o build/temp.macosx-10.4-x86_64-2.7/_mysql.o -Qunused-arguments -g 

_mysql.c:1: error: bad value (native) for -march= switch 

_mysql.c:1: error: bad value (native) for -mtune= switch 

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

---------------------------------------- 
Command /usr/local/Cellar/python/2.7.3/bin/python -c "import setuptools;__file__='/Users/lukasz/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/lv/p8rbhkk559x1337twh8flq0r0000gn/T/pip-Bvu67T-record/install-record.txt failed with error code 1 in /Users/lukasz/build/MySQL-python 
Storing complete log in /Users/lukasz/.pip/pip.log 
(lukasz) ~ > 

Mysql的用自制的安裝沒有問題:

(lukasz) ~ > brew info mysql 
mysql 5.5.25 
http://dev.mysql.com/doc/refman/5.5/en/ 
Depends on: cmake, readline, pidof 
/usr/local/Cellar/mysql/5.5.25 (6382 files, 222M) * 
fatal: Not a git repository (or any of the parent directories): .git 
https://github.com//homebrew/commits/master/Library/Formula/mysql.rb 

有沒有一種辦法手動修改三月標誌?

UPDATE:

哦,我還安裝了命令行工具(Xcode中 - >設置 - >下載),這顯然是GCC-4.2創建鏈接:

(lukasz) ~ > which gcc-4.2 
/usr/bin/gcc-4.2 
(lukasz) ~ > ls -l `which gcc-4.2` 
lrwxr-xr-x 1 root wheel 12 12 Jun 01:36 /usr/bin/gcc-4.2 -> /usr/bin/gcc 
(lukasz) ~ > gcc-4.2 --version 
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) 
... 
+0

Xcode 4.3不提供'gcc-4.2',因此您似乎正在使用從其他源安裝的編譯器。 gcc-4.2 --version是什麼意思? –

+0

@NedDeily,好像命令行工具創建的鏈接(的Xcode>首選項>下載...) (盧卡斯) - >這GCC-4.2 /usr/bin/gcc-4.2 (盧卡斯) - > LS -l'其中gcc-4.2' lrwxr-xr-x 1個根輪12 12 6月01:36 /usr/bin/gcc-4.2->/usr/bin/gcc (lukasz)〜> gcc-4.2 - 版本 i686-apple-darwin11-llvm-gcc-4.2(GCC)4.2.1(基於Apple Inc. build 5658)(LLVM build 2336.9.00) ... – lukaszb

+0

據我所知,Apple的命令行工具不要爲gcc-4.2安裝一個符號鏈接(我剛剛證實,剛纔發佈的Xcode 4.3.3及其命令行工具沒有改變)。但是它所鏈接的llvm-gcc是最新的Apple gcc。所以這不是問題。這些標誌通常不適用於任何Apple編譯器;他們通常使用'-arch'。這可能是由一個雜散的環境變量設置注入的,如CFLAGS或LDFLAGS。另外,通過運行mysql_config來檢查mysql配置中記錄的內容; MySQL-python着眼於它。 –

回答

1

這可能會有些偏離主題,但如果最終你將無法編譯MySQL-python,則可以嘗試PyMySQL這是純粹的Python mysql客戶端,可以替代MySQL-python。它工作得很快。