我做了pip install pycrypto
(实际上想安装fabric
但是在pycrypto失败了)并得到了以下错误。我在python 2.7.3上。尝试3.3也是同样的错误。我该如何解决这个问题?
我的铿锵版:
$ 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 :(得分:0)
我使用的是HPC版本的gcc。所以我删除了它并重新安装了Xcode中的命令行工具。然后我就能安装pycrypto和fabric。