2015-04-30 325 views
1

我試圖通過運行以下命令,在Mac OS X上安裝pycrypto包:pycrypto安裝失敗

ARCHFLAGS=-Wno-error CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sudo -E pip install pycrypto** 

但它失敗,並顯示以下錯誤:

/usr/bin/clang -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/opt/local/lib -Wno-error -L/opt/local/lib -I/opt/local/include -Wno-error build/temp.macosx-10.6-x86_64-3.4/src/_fastmath.o -lgmp -o build/lib.macosx-10.6-x86_64-3.4/Crypto/PublicKey/_fastmath.so

ld: library not found for -lSystem

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command '/usr/bin/clang' failed with exit status 1

回答

2

我有通過運行以下命令修復此問題 -

CFLAGS =「 - isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/usr/local/include 「LDFLA GS =「 - L/usr/local/lib」pip install pycrypto

問題在於我的默認'-isysroot'指向10.6 SDK,而clang文件來自10.9 SDK。

-Gaurav

+0

這對我有效,謝謝! (在osx 10.11.2上使用sdk 10.11) – verboze

+0

謝謝。將10.9.sdk更改爲10.11.sdk也適用於我。 – Singletoned

2
ld: library not found for -lgmp 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
error: command 'clang' failed with exit status 1 

對於上述錯誤,以下爲我工作的優勝美地。

brew install gmp 
export LIBRARY_PATH=/usr/local/lib 
pip install pycrypto 
+0

也曾在El Capitan工作過(OSX 10.11.4) – user2707671