2012-10-24 57 views
1

我做了pip install pycrypto(實際上想安裝fabric,但它在pycrypto失敗)並且得到了下面的錯誤。我在python 2.7.3上。也試過3.3但同樣的錯誤。我該如何解決這個問題?鏈接器命令在OSX上fastmath安裝pycrypto失敗

我鐺版本:

$ clang --version 
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) 
Target: x86_64-apple-darwin11.4.2 
Thread model: posix 

錯誤:

... 

creating build/lib.macosx-10.7-x86_64-2.7/Crypto/Signature 

copying lib/Crypto/Signature/__init__.py -> build/lib.macosx-10.7-x86_64-2.7/Crypto/Signature 

copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.macosx-10.7-x86_64-2.7/Crypto/Signature 

copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.macosx-10.7-x86_64-2.7/Crypto/Signature 

running build_ext 

running build_configure 

building 'Crypto.PublicKey._fastmath' extension 

creating build/temp.macosx-10.7-x86_64-2.7 

creating build/temp.macosx-10.7-x86_64-2.7/src 

cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_fastmath.c -o build/temp.macosx-10.7-x86_64-2.7/src/_fastmath.o 

src/_fastmath.c:1545:20: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] 

         else if (result < 0) 

           ~~~~~~^~ 

src/_fastmath.c:1621:20: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] 

         else if (result < 0) 

           ~~~~~~^~ 

2 warnings generated. 

cc -bundle -undefined dynamic_lookup -L/usr/local/lib build/temp.macosx-10.7-x86_64-2.7/src/_fastmath.o -lgmp -o build/lib.macosx-10.7-x86_64-2.7/Crypto/PublicKey/_fastmath.so 

ld: illegal text-relocation to ___gmp_binvert_limb_table in /usr/local/lib/libgmp.a(mp_minv_tab.o) from ___gmpn_divexact_1 in /usr/local/lib/libgmp.a(dive_1.o) for architecture x86_64 

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

error: command 'cc' failed with exit status 1 

---------------------------------------- 

Command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-riA3zG-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-build/pycrypto 

Exception information: 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main 
    status = self.run(options, args) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 261, in run 
    requirement_set.install(install_options, global_options) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1166, in install 
    requirement.install(install_options, global_options) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 589, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 612, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-riA3zG-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/_2/fwbd8jjn0mj_y_9w4f31g2nm0000gn/T/pip-build/pycrypto 

回答

0

我使用gcc的HPC版本。所以我刪除了它,並在Xcode中重新安裝了命令行工具。然後我能夠安裝pycrypto和fabric。